Is there a way to only display frames from a video that only have detected object bounding boxes
I'm using a video for testing my custom yolov5s object detection model on test data. However, not every frame in the video has a valid object to be detected.
[ When the inference testing is ran on the video, the image below shows when the model finds a frame that has an object that can be detected and classified
As you can see, frame 4401 has detected a yield traffic sign but frame 4399 and 4400 haven't detected anything. My question is how do I process through 4500 frames of a video and only display frames that have detected objects. I have extracted the frames as JPEGS but only want the valid JPEGS to evaluate test performance? Better still, is it possible to extract the data from relevant frames to a text file?
If anyone could help me out this would be a great help and time saver, many thanks in advance.
the new error

from shutil import move
import os

txt_dir = &quot;txtfiles&quot;
images_folder = &quot;images_folder&quot;
move_des = &quot;move_imgs_path&quot;

for file in os.listdir(txt_dir):
    if file.endswith('txt'):
          frame_name = file.split('.')[0]+ &quot;.jpeg&quot;
          print(frame_name)
          move(os.path.join(images_folder, frame_name), move_des)

