logo

attribute error 谢谢大佬

2018-07-29 11:16
0
_17723174802

attributeerror:'image' object has no attribute 'find_number'

X
Yuan

来自星瞳实验室APP: 如何压缩图像后使用find_number。https://forum.singtown.com/topic/911

2018-07-29 15:02
0
_17723174802
97c0bba8-fe2a-4653-827e-b867afbf0ebd.png
I
网红小智智 星瞳科技

OpenMV2是没有这个函数的。

OpenMV3最新3.0.0的固件已经删除了这个函数。采用lenet神经网络进行数字识别。

0
_17723174802

@kidswong999 谢谢 不过我买的OpenMV3 R2 怎么回事啊

I
网红小智智 星瞳科技

请贴出具体的代码,与报错提示。

代码一定要让别人可以运行的文本,不要贴图片

X
Yuan

http://book.openmv.cc/example/25-Machine-Learning/nn_lenet_search_just_center.html

ide里面内置的数字识别CNN模型偏大,在F7上运行可能会出现内存不足问题,建议可以自己训练较小的神经网络模型。

I
网红小智智 星瞳科技

@yuan 他的提示是image 没有 find_number这个属性。又不是运行模式有问题。

我猜是代码有问题。报错误的问题,应该直接贴代码。

0
_17723174802

@kidswong999

import sensor, image, time

sensor.reset()                       
sensor.set_contrast(3)
sensor.set_pixformat(sensor.GRAYSCALE) 
sensor.set_framesize(sensor.VGA)        
sensor.set_windowing((128, 128))       
sensor.skip_frames(time = 2000)         
sensor.set_auto_gain(False)
sensor.set_auto_exposure(False)

while(True):
    img = sensor.snapshot()
    out = img.find_number(roi=(img.width()//2-14, img.height()//2-14, 28, 28))
    img.draw_rectangle((img.width()//2-15, img.height()//2-15, 30, 30))
    if out[1] > 5:
        print("Number: %d Confidence: %0.2f" %(out[0], out[1]))

我先直接用的源码测试都不行

X
Yuan

最新3.0.0的固件因为增加了新的lenet神经网络例程(我上面回复的链接),已经删除find_number这个函数了,所以会这么报错。

2018-07-29 15:22
0
_17723174802

@yuan @kidswong999 回头试试 非常感谢