图像分类如何制作程序'几秒钟
因此,我正在对4个类(类别1,2,3和背景)进行简单的图像分类,
它是从带有LowRes的网络摄像头设备中直播的,所以我在一段时间内将其进行了,
cond = True
While(cond):
**code**
if confidence_value >= 0.98:
##print only the class i.e. index 0 is the class and index 1 gives the value
top_class = top_value[0]
#stops the while loop
cond = False
print('While loop stopped, class detected as:', top_class)
else:
print('Unable to decide')
cond = True
现在代码在原则上运行,但是由于背景是背景类是最容易检测的,并且数据正在不断拉动,在图像之前,它有可能首先检测到背景类。为此,我有一个简单的野蛮解决方案,即在图像进入
第二位时,将设备“睡眠”约为3s,即即使EG 1类也是如此,它也会检测到背景类别。一阵子。我计划获取更多数据以使其更加健壮,但是就目前而同时检测到其他类。
So i am doing a simple image classification of 4 classes (Class1,2,3 and background)
It's fed live from like a webcam-ish device with lowres so i have it in a While Loop
cond = True
While(cond):
**code**
if confidence_value >= 0.98:
##print only the class i.e. index 0 is the class and index 1 gives the value
top_class = top_value[0]
#stops the while loop
cond = False
print('While loop stopped, class detected as:', top_class)
else:
print('Unable to decide')
cond = True
Now the code runs in principle but since the background class is the easiest to detect, and the data is constantly pulling, there's a chance it'll detect the background class first before the image is in view. For this i have a simple if brutalistic solution of having the device 'sleep' for about 3s while the image gets into view
The 2nd bit which pertains to this question is sometimes even if e.g. class 1 is in view, it'll detect background class for awhile. I plan to get more data to make it more robust too but for now, is it possible where if it detects the background class, for the code to 'ignore' this class for about maybe 5s before it outputs as background class just in case that the other classes are detected in the meantime.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许在其中放置条件,如果课程是背景检查,那么第二级顶级课程并具有一定的阈值。因此,说出背景是否检测到第二最佳信心是什么,然后使用该课程。
Maybe put a condition in there and if class is background check the 2nd top class and have some threshold. So say if it detects background see what 2nd best confidence was and use that class instead.