-
-
Notifications
You must be signed in to change notification settings - Fork 16.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Detect source as .txt error #1877
Comments
command used run.txt has paths to the images, just like we use in training |
@pngmafia at the moment a text file passed to detect.py may only contain RTSP/HTTP/RTMP streaming addresses, not local media. |
@glenn-jocher are you guys working on providing support for .txt file, which contains path of images. |
@m3sibti there's no current plans for this. Could you use the glob command instead? python detect.py --source path/*.jpg Also note that YOLOv5 autoshape models from PyTorch Hub have the capability for inputting lists of local or internet image paths. See https://github.com/ultralytics/yolov5#pytorch-hub |
For YOLOv5 authoshape model inference from image paths or URIs: def forward(self, imgs, size=640, augment=False, profile=False):
# Inference from various sources. For height=720, width=1280, RGB images example inputs are:
# filename: imgs = 'data/samples/zidane.jpg'
# URI: = 'https://github.com/ultralytics/yolov5/releases/download/v1.0/zidane.jpg'
# OpenCV: = cv2.imread('image.jpg')[:,:,::-1] # HWC BGR to RGB x(720,1280,3)
# PIL: = Image.open('image.jpg') # HWC x(720,1280,3)
# numpy: = np.zeros((720,1280,3)) # HWC
# torch: = torch.zeros(16,3,720,1280) # BCHW
# multiple: = [Image.open('image1.jpg'), Image.open('image2.jpg'), ...] # list of images |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
When running detect.py with source as a txt it is loading the images but getting this error:
Traceback (most recent call last): File "detect.py", line 181, in <module> detect() File "detect.py", line 49, in detect dataset = LoadStreams(source, img_size=imgsz) File "/mnt1/yolo3/utils/datasets.py", line 286, in __init__ s = np.stack([letterbox(x, new_shape=self.img_size)[0].shape for x in self.imgs], 0) # inference shapes File "/mnt1/yolo3/utils/datasets.py", line 286, in <listcomp> s = np.stack([letterbox(x, new_shape=self.img_size)[0].shape for x in self.imgs], 0) # inference shapes File "/mnt1/yolo3/utils/datasets.py", line 696, in letterbox shape = img.shape[:2] # current shape [height, width] AttributeError: 'NoneType' object has no attribute 'shape'
please help!!
The text was updated successfully, but these errors were encountered: