Open
Description
Search before asking
- I have searched the YOLOv5 issues and discussions and found no similar questions.
Question
I am trying to inference on a batch of images in a directory. The basic inference code is the one used , I have already read the documentation for the Detections return, is there any way to get the detected objects as .txt ? In a similar way to result.print() , it shows the objects and the times they appear.
I am aware that detect.py can save as .txt but couldn't do inference on batch of images with it.
model = torch.hub.load('ultralytics/yolov5', 'yolov5s')
# Images
directory = 'keyframes/'
frames = [] # batch of images
for filename in os.listdir(directory):
frame = Image.open('keyframes/'+filename)
frames.append(frame)
# Inference
results = model(frames, size=640)
# Results
results.print()
results.save() ```
What I need is the objects detected in a .txt file without using detect.py, but if detect.py can be modified to work on batch of images from a directory that would also work.
### Additional
_No response_