i am doing a simple image classification of 4 classes (Class1,2,3 and background)
This is snippet of the code
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 #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 however is this the best method? or is there a more ‘elegant’ way of doing it
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. If so, any suggestions on how it would be done?