星瞳实验室APP,快速收到回复
  • 我们只解决官方正版的OpenMV的问题(STM32),其他的分支有很多兼容问题,我们无法解决。
  • 如果有产品硬件故障问题,比如无法开机,论坛很难解决。可以直接找售后维修
  • 发帖子之前,请确认看过所有的视频教程,https://singtown.com/learn/ 和所有的上手教程http://book.openmv.cc/
  • 每一个新的提问,单独发一个新帖子
  • 帖子需要目的,你要做什么?
  • 如果涉及代码,需要报错提示全部代码文本,请注意不要贴代码图片
  • 必看:玩转星瞳论坛了解一下图片上传,代码格式等问题。
  • 神经网络训练(EDGE IMPULSE)的压缩包打开一直错误(但看文件好像可以用)然后用里面的模型时,一运行就断开连接



    • # Edge Impulse - OpenMV Image Classification Example
      
      import sensor, image, time, os, tf
      
      sensor.reset()                         # Reset and initialize the sensor.
      sensor.set_pixformat(sensor.GRAYSCALE)    # 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.
      
      net = "trained.tflite"
      labels = ["3","8"]
      
      clock = time.clock()
      while(True):
          clock.tick()
      
          img = sensor.snapshot()
      
          # default settings just do one detection... change them to search the image...
          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())
              # This combines the labels and confidence values into a list of tuples
              predictions_list = list(zip(labels, obj.output()))
      
              for i in range(len(predictions_list)):
                  print("%s = %f" % (predictions_list[i][0], predictions_list[i][1]))
      
          print(clock.fps(), "fps")
      
      

      0_1636106239721_94e13821f4a9bf75673b523d0190568.png



    • 固件版本是什么?



    • openmv-H7 R1



    • 神经网络只能在OpenMV4 Plus上运行的。
      OpenMV4 不行。



    • 但是我这个就可以运行啊

      #导入功能包
      import pyb
      import sensor, image, time, math
      import os, tf
      
      #摄像头传感器配置
      sensor.reset()
      sensor.set_pixformat(sensor.RGB565)
      sensor.set_framesize(sensor.QVGA) # we run out of memory if the resolution is much bigger...
      sensor.set_brightness(500)
      sensor.skip_frames(time = 20)
      sensor.set_auto_gain(True)  # must turn this off to prevent image washout...
      sensor.set_auto_whitebal(True,(0,0x80,0))  # must turn this off to prevent image washout...
      clock = time.clock()
      
      #导入模型
      net_path = "mnist_acc_0.9921_quant.tflite"                                  # 定义模型的路径
      labels = ["0", "1", "2", "3","4","5", "6", "7", "8", "9"]   # 加载标签
      net = tf.load(net_path, load_to_fb=True)                                  # 加载模型
      
      
      while(True):
          #拍摄一张照片
          img = sensor.snapshot()
          #寻找矩形
          for r in img.find_rects(threshold = 50000):
              #矩形画框
              img.draw_rectangle(r.rect(), color = (255, 0, 0))
              #提取矩形中图像
              img1 = img.copy(r.rect())
              #运行模型识别
              for obj in tf.classify(net , img1, min_scale=1.0, scale_mul=0.5, x_overlap=0.0, y_overlap=0.0):
                  #计算结果
                  sorted_list = sorted(zip(labels, obj.output()), key = lambda x: x[1], reverse = True)
                  #在图像中画出结果
                  img.draw_string(r.rect()[0] + 20, r.rect()[1]-20, sorted_list[0][0],color = (255,0,0), scale = 2,mono_space=False)
      
      


    • 这个是mnist,一个非常小的网络。

      edge impulse是mobilenet,比mnist的网络大很多。



    • 你这个mnist是哪来的?我不记得OpenMV发布过这个。