图像分类如何制作程序'几秒钟

发布于 2025-02-13 04:52:42 字数 691 浏览 3 评论 0原文

因此,我正在对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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

短叹 2025-02-20 04:52:42

也许在其中放置条件,如果课程是背景检查,那么第二级顶级课程并具有一定的阈值。因此,说出背景是否检测到第二最佳信心是什么,然后使用该课程。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文