星瞳实验室APP,快速收到回复
  • 我们只解决官方正版的OpenMV的问题(STM32),其他的分支有很多兼容问题,我们无法解决。
  • 如果有产品硬件故障问题,比如无法开机,论坛很难解决。可以直接找售后维修
  • 发帖子之前,请确认看过所有的视频教程,https://singtown.com/learn/ 和所有的上手教程http://book.openmv.cc/
  • 每一个新的提问,单独发一个新帖子
  • 帖子需要目的,你要做什么?
  • 如果涉及代码,需要报错提示全部代码文本,请注意不要贴代码图片
  • 必看:玩转星瞳论坛了解一下图片上传,代码格式等问题。
  • 为什么我的openmv(cam M4-OV7725)载入机器学习网络文件的时候,内存报分配错误?



    • # TensorFlow Lite Person Dection Example
      #
      # Google's Person Detection Model detects if a person is in view.
      #
      # In this example we slide the detector window over the image and get a list
      # of activations. Note that use a CNN with a sliding window is extremely compute
      # expensive so for an exhaustive search do not expect the CNN to be real-time.
      
      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.
      
      # Load the built-in person detection network (the network is in your OpenMV Cam's firmware).
      net = tf.load('./mobilenet_small_quant.tflite')
      labels = ["Angry", "Disgust", "Fear", "Happy", "Sad", "Surprise", "Neutral"]
      
      clock = time.clock()
      while(True):
          clock.tick()
      
          img = sensor.snapshot()
      
          # net.classify() will run the network on an roi in the image (or on the whole image if the roi is not
          # specified). A classification score output vector will be generated for each location. At each scale the
          # detection window is moved around in the ROI using x_overlap (0-1) and y_overlap (0-1) as a guide.
          # If you set the overlap to 0.5 then each detection window will overlap the previous one by 50%. Note
          # the computational work load goes WAY up the more overlap. Finally, for multi-scale matching after
          # sliding the network around in the x/y dimensions the detection window will shrink by scale_mul (0-1)
          # down to min_scale (0-1). For example, if scale_mul is 0.5 the detection window will shrink by 50%.
          # Note that at a lower scale there's even more area to search if x_overlap and y_overlap are small...
      
          # default settings just do one detection... change them to search the image...
          for obj in net.classify(img, min_scale=1.0, scale_mul=0.5, x_overlap=0.0, y_overlap=0.0):
              print("**********\nDetections at [x=%d,y=%d,w=%d,h=%d]" % obj.rect())
              for i in range(len(obj.output())):
                  print("%s = %f" % (labels[i], obj.output()[i]))
              img.draw_rectangle(obj.rect())
              img.draw_string(obj.x()+3, obj.y()-1, labels[obj.output().index(max(obj.output()))], mono_space = False)
          print(clock.fps(), "fps")
      
      

      报错信息:MemoryError: memory allocation failed, allocating 156856 bytes MicroPython: v1.15-r57 OpenMV: v4.1.1 HAL: v1.2.8 BOARD: OPENMV3-STM32F765



    • 只能OpenMV 4 Plus上用,你的是OpenMV3



    • This post is deleted!


    • @kidswong999 我去试了一下,tf的库都不行,然后我准备用network神经网络的,但是IDE却提示ImportError: no module named 'nn',没有nn的库,这是什么情况?



    • edge impulse只能OpenMV 4 Plus上用,你的是OpenMV3,所以用不了。



    • nn的库早就被删除了,用不了。