Custom object detection with YOLO for multiple images at once
Hi, I've trained YOLO v3 on my custom dataset, thanks :) And now I am using it on multiple images sampled from video records. Is there a function like, to say, detectMultipleImages() for object detection? I just try to give the list of images at once. The one I am looking for is just like the one mentioned in the documentation of custom prediction, as follows: ".predictMultipleImages() , This function can be used to perform prediction on 2 or more images at once. Find example code, parameters of the function and returned values below"
If there is already a way of doing this with imageai, could you share it? If not, I am going to try using OpenCV's cv2.dnn.blobFromImages method. (https://github.com/emasterclassacademy/Single-Multiple-Custom-Object-Detection/blob/master/1.%20Project%20-%20Custom%20Object%20Detection/Object_Detection.py) -- I already tried the code at this link but the model load was not successful and config file format was different, I may need to train my model again by using a different library...
Suggestions of any kind would be greatly appreciated. Healthy days,
ImageAI doesn't have a detectMultipleImages() function for now. It may be added in the future.
I think you can create a function to get image and config file which holds the index of images Create a file named multi-instances
Now you can use `subprocess.Popen(f"python {os.getcwd()}//{executable_file}", shell=True) and iterate over len(images)
Note: Don't forget to sleep sometime, I literally use 1s between instances, since it may overburden your cpu to open 100 images right!
Results: To track results run an infinite loop inside your multi-instances file after successfully opened all instances
Code Snippet:
from win32api import GetKeyState
def escape_pressed():
"""Sleep until escape pressed"""
while True:
if GetKeyState(0x1B) < 0:
break
time.sleep(0.1)
n = 10
executable_file = "iqfaucet.py"
def main():
for t in range(n):
subprocess.Popen(f"python {os.getcwd()}//{executable_file}", shell=True)
time.sleep(30)
print("Session: started\nPress 'Escape key' to quit program")
escape_pressed()