@kidswong999 用opnemv录制好的3分钟视频
5zgb
@5zgb
5zgb 发布的帖子
-
RE: 垃圾识别,垃圾种类增加到10种后IMPLUSE网站训练的模型识别准确率降低,如何解决?或者有其他训练网站吗?
@kidswong999 垃圾分类识别电池很识别成易拉罐,这是采集照片的问题吗?我看例程上识别是百分百,有什么方法吗?
-
如何在垃圾识别代码上写代码使识别到的垃圾上画框圈住,并且返回那个框的中心坐标
import sensor, image, time, os, tf, lcd
from pyb import UART
uart = UART(3, 19200)
a = 0
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QVGA)
sensor.set_windowing((240, 240))
sensor.skip_frames(time=2000)
lcd.init()
net = "trained.tflite"
labels = [line.rstrip('\n') for line in open("labels.txt")]
clock = time.clock()
while(True):
clock.tick()
img = sensor.snapshot()
for obj in tf.classify(net, img, min_scale=1.0, scale_mul=0.8, x_overlap=0.5, y_overlap=0.5):
print("**********\nPredictions at [x=%d,y=%d,w=%d,h=%d]" % obj.rect())
img.draw_rectangle(obj.rect())
predictions_list = list(zip(labels, obj.output()))
b =(max(zip( obj.output(),labels)))
b =b[1]
print(b)
uart.write(b+'\n')
if uart.readline():
c = uart.readline()
print(c)
time.sleep_ms(2000)
if b == ('blank'):
a = a
else:
a = a+1
img.draw_string(10,10,str(a)+'\n' + str(b)+'\n'+'1'+'\n'+'ok')
lcd.display(img)
time.sleep_ms(3000)
for i in range(len(predictions_list)):
print("%s = %f" % (predictions_list[i][0], predictions_list[i][1]))
print(clock.fps(), "fps") -
image.ImageReader 代码报错是怎么回事?
#读取图片例程 # # 注意:您将需要SD卡来运行此示例。 # # 此示例显示如何使用图像读取器对象来重放OpenMV在Image Writer对象中保存 # 的用于测试机器视觉算法的快照。 import sensor, image, time snapshot_source = False # 一旦完成从传感器提取数据,设置为true sensor.reset() sensor.set_pixformat(sensor.RGB565) sensor.set_framesize(sensor.QQVGA) sensor.skip_frames(time = 2000) clock = time.clock() img_reader = None if snapshot_source else image.ImageReader("/stream.bin") while(True): clock.tick() img = sensor.snapshot() if snapshot_source else img_reader.next_frame(copy_to_fb=True, loop=True) # 在这里对图像进行机器视觉算法。 print(clock.fps()) ```代码报错AttributeError: 'module' object has no attribute 'ImageReader'
-
例程讲解-06-gif录制动图,这个代码录制的动图在哪里看?
# # 注意:您将需要SD卡来运行此示例。 # # You can use your OpenMV Cam to record gif files. You can either feed the # recorder object RGB565 frames or Grayscale frames. Use photo editing software # like GIMP to compress and optimize the Gif before uploading it to the web. # 你可以用你的OpenMV摄像头来记录gif文件。您可以提供记录器对象RGB565帧或灰度帧。 # 使用像GIMP这样的照片编辑软件来压缩和优化Gif,然后再上传到web。 import sensor, image, time, gif, pyb RED_LED_PIN = 1 BLUE_LED_PIN = 3 sensor.reset() # 初始化sensor sensor.set_pixformat(sensor.RGB565) # or sensor.GRAYSCALE #设置图像色彩格式,有RGB565色彩图和GRAYSCALE灰度图两种 sensor.set_framesize(sensor.QQVGA) # or sensor.QVGA (or others) #设置图像像素大小 sensor.skip_frames(time = 2000) # 让新的设置生效 clock = time.clock() # 跟踪FPS帧率 pyb.LED(RED_LED_PIN).on() sensor.skip_frames(30) # Give the user time to get ready. #程序开始时,先等待30帧图像,让用户有时间准备 pyb.LED(RED_LED_PIN).off() pyb.LED(BLUE_LED_PIN).on() g = gif.Gif("example.gif", loop=True) #gif.Gif(filename, width=Auto, height=Auto, color=Auto, loop=True)创建一个gif对象,filename为保存gif动图的文件路径 print("You're on camera!") for i in range(100): clock.tick() # clock.avg()返回帧与帧之间的毫秒数,其中包含gif延迟 g.add_frame(sensor.snapshot(), delay=10) # centiseconds. #gif.add_frame(image, delay=10),向gif动图中添加图片,delay=10指每隔 #10分秒添加一张图。 print(clock.fps()) g.close() pyb.LED(BLUE_LED_PIN).off() print("Done! Reset the camera to see the saved recording.") 请在这里粘贴代码