求助: 'module' object has no attribute 'classify'
-
大神帮忙看看,我这个是训练过程出错了吗?
AttributeError: 'module' object has no attribute 'classify'
看着似乎是tf模块没加载上,没搞明白为啥,是训练包生成的py文件
-
4.5.6之后把tf删除了,替换成了ml库。
# This code run in OpenMV4 H7 Plus import sensor, image, time, os, ml sensor.reset() # Reset and initialize the sensor. sensor.set_pixformat(sensor.RGB565) # Set pixel format to RGB565 (or GRAYSCALE) sensor.set_framesize(sensor.QVGA) # Set frame size to QVGA (320x240) sensor.set_windowing((240, 240)) # Set 240x240 window. sensor.skip_frames(time=2000) # Let the camera adjust. model = ml.Model("trained.tflite", load_to_fb=True) labels = [line.rstrip() for line in open("labels.txt")] class_num = len(labels) clock = time.clock() while True: clock.tick() img = sensor.snapshot() scores = model.predict([img])[0].flatten().tolist() for i in range(class_num): print("%s = %f" % (labels[i], scores[i])) print(clock.fps(), "fps")
-
嗯,版本问题,固件不兼容了,需要回退版本4.5.4