Closed NaeemKhan333 closed 4 years ago
Hello @NaeemKhan333, thank you for your interest in our work! Please visit our Custom Training Tutorial to get started, and see our Jupyter Notebook , Docker Image, and Google Cloud Quickstart Guide for example environments.
If this is a bug report, please provide screenshots and minimum viable code to reproduce your issue, otherwise we can not help you.
If this is a custom model or data training question, please note Ultralytics does not provide free personal support. As a leader in vision ML and AI, we do offer professional consulting, from simple expert advice up to delivery of fully customized, end-to-end production solutions for our clients, such as:
For more information please visit https://www.ultralytics.com.
Hello, thank you for your interest in our work! This issue seems to lack the minimum requirements for a proper response, or is insufficiently detailed for us to help you. Please note that most technical problems are due to:
Your changes to the default repository. If your issue is not reproducible in a new git clone
version of this repository we can not debug it. Before going further run this code and ensure your issue persists:
sudo rm -rf yolov5 # remove existing
git clone https://github.com/ultralytics/yolov5 && cd yolov5 # clone latest
python detect.py # verify detection
# CODE TO REPRODUCE YOUR ISSUE HERE
Your custom data. If your issue is not reproducible with COCO or COCO128 data we can not debug it. Visit our Custom Training Tutorial for guidelines on training your custom data. Examine train_batch0.jpg
and test_batch0.jpg
for a sanity check of training and testing data.
Your environment. If your issue is not reproducible in one of the verified environments below we can not debug it. If you are running YOLOv5 locally, ensure your environment meets all of the requirements.txt dependencies specified below.
If none of these apply to you, we suggest you close this issue and raise a new one using the Bug Report template, providing screenshots and minimum viable code to reproduce your issue. Thank you!
Python 3.8 or later with all requirements.txt dependencies installed, including torch>=1.6
. To install run:
$ pip install -r requirements.txt
YOLOv5 may be run in any of the following up-to-date verified environments (with all dependencies including CUDA/CUDNN, Python and PyTorch preinstalled):
If this badge is green, all YOLOv5 GitHub Actions Continuous Integration (CI) tests are passing. These tests evaluate proper operation of basic YOLOv5 functionality, including training (train.py), testing (test.py), inference (detect.py) and export (export.py) on MacOS, Windows, and Ubuntu.
I have a similar issue. I fix it by updating PyTorch to 1.6.0.
Is there a solution for old pytorch version? (say torch1.4 with cuda9.1)
Thx.
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.
(py38cuda102) qian@amax:~/anaconda3/envs/py38cuda102/bin$ nvidia-smi Mon Mar 8 21:49:26 2021 +-----------------------------------------------------------------------------+ | NVIDIA-SMI 410.73 Driver Version: 410.73 CUDA Version: 10.0 | |-------------------------------+----------------------+----------------------+ | GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC | | Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. | |===============================+======================+======================| | 0 GeForce RTX 208... Off | 00000000:04:00.0 Off | N/A | | 22% 40C P0 54W / 250W | 0MiB / 10989MiB | 0% Default | +-------------------------------+----------------------+----------------------+ | 1 GeForce RTX 208... Off | 00000000:05:00.0 Off | N/A | | 22% 43C P0 74W / 250W | 0MiB / 10989MiB | 0% Default | +-------------------------------+----------------------+----------------------+ | 2 GeForce RTX 208... Off | 00000000:08:00.0 Off | N/A | | 23% 45C P0 67W / 250W | 0MiB / 10989MiB | 0% Default | +-------------------------------+----------------------+----------------------+ | 3 GeForce RTX 208... Off | 00000000:09:00.0 Off | N/A | | 24% 44C P0 57W / 250W | 0MiB / 10989MiB | 0% Default | +-------------------------------+----------------------+----------------------+ | 4 GeForce RTX 208... Off | 00000000:84:00.0 Off | N/A | | 23% 41C P0 62W / 250W | 0MiB / 10989MiB | 0% Default | +-------------------------------+----------------------+----------------------+ | 5 GeForce RTX 208... Off | 00000000:85:00.0 Off | N/A | | 21% 44C P0 65W / 250W | 0MiB / 10989MiB | 1% Default | +-------------------------------+----------------------+----------------------+ | 6 GeForce RTX 208... Off | 00000000:88:00.0 Off | N/A | | 22% 42C P0 72W / 250W | 0MiB / 10989MiB | 1% Default | +-------------------------------+----------------------+----------------------+ | 7 GeForce RTX 208... Off | 00000000:89:00.0 Off | N/A | | 34% 43C P0 58W / 250W | 0MiB / 10989MiB | 0% Default | +-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+ | Processes: GPU Memory | | GPU PID Type Process name Usage | |=============================================================================| | No running processes found | +-----------------------------------------------------------------------------+
================================================================================= I created a virtual env (py38cuda102) with python 3.8, cuda10.2 , pytorch 1.8.0 , don't know why I run: 'python -V' , it showed :
when I run : python detection.py , it showed :
(py38cuda102) qian@amax:~/YOLOv5/yolov5$ python detect.py Namespace(agnostic_nms=False, augment=False, classes=None, conf_thres=0.4, device='', img_size=640, iou_thres=0.5, output='inference/output', save_txt=False, source='inference/images', update=False, view_img=False, weights='yolov5s.pt') Using CUDA device0 _CudaDeviceProperties(name='GeForce RTX 2080 Ti', total_memory=10989MB) device1 _CudaDeviceProperties(name='GeForce RTX 2080 Ti', total_memory=10989MB) device2 _CudaDeviceProperties(name='GeForce RTX 2080 Ti', total_memory=10989MB) device3 _CudaDeviceProperties(name='GeForce RTX 2080 Ti', total_memory=10989MB) device4 _CudaDeviceProperties(name='GeForce RTX 2080 Ti', total_memory=10989MB) device5 _CudaDeviceProperties(name='GeForce RTX 2080 Ti', total_memory=10989MB) device6 _CudaDeviceProperties(name='GeForce RTX 2080 Ti', total_memory=10989MB) device7 _CudaDeviceProperties(name='GeForce RTX 2080 Ti', total_memory=10989MB)
Downloading https://github.com/ultralytics/yolov5/releases/download/v3.0/yolov5s.pt to yolov5s.pt... 100%|████████████████████████████████████████████████████| 14.5M/14.5M [05:46<00:00, 43.9kB/s]
Traceback (most recent call last): File "/home/qian/anaconda3/lib/python3.7/tarfile.py", line 187, in nti n = int(s.strip() or "0", 8) ValueError: invalid literal for int() with base 8: 'py\nndarr'
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/home/qian/anaconda3/lib/python3.7/tarfile.py", line 2289, in next tarinfo = self.tarinfo.fromtarfile(self) File "/home/qian/anaconda3/lib/python3.7/tarfile.py", line 1095, in fromtarfile obj = cls.frombuf(buf, tarfile.encoding, tarfile.errors) File "/home/qian/anaconda3/lib/python3.7/tarfile.py", line 1037, in frombuf chksum = nti(buf[148:156]) File "/home/qian/anaconda3/lib/python3.7/tarfile.py", line 189, in nti raise InvalidHeaderError("invalid header") tarfile.InvalidHeaderError: invalid header
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/home/qian/anaconda3/lib/python3.7/site-packages/torch/serialization.py", line 595, in _load return legacy_load(f) File "/home/qian/anaconda3/lib/python3.7/site-packages/torch/serialization.py", line 506, in legacy_load with closing(tarfile.open(fileobj=f, mode='r:', format=tarfile.PAX_FORMAT)) as tar, \ File "/home/qian/anaconda3/lib/python3.7/tarfile.py", line 1591, in open return func(name, filemode, fileobj, kwargs) File "/home/qian/anaconda3/lib/python3.7/tarfile.py", line 1621, in taropen return cls(name, mode, fileobj, kwargs) File "/home/qian/anaconda3/lib/python3.7/tarfile.py", line 1484, in init self.firstmember = self.next() File "/home/qian/anaconda3/lib/python3.7/tarfile.py", line 2301, in next raise ReadError(str(e)) tarfile.ReadError: invalid header
During handling of the above exception, another exception occurred:
My question : how can I fix this ?
Simply,Update Pytorch version to latest for removing the error of "zip archive"
If anyone still needs to run this project with old versions of pytorch (for example if new versions of pytorch doesn't support your GPU), I made a fork and ported it to pytorch 1.3. It has minimal changes to the original code. I also made a notebook to convert pretrained models from new format to old one.
python detect.py --source ./inference/images/ --weights yolov5m.pt --conf 0.4 Namespace(agnostic_nms=False, augment=False, classes=None, conf_thres=0.4, device='', img_size=640, iou_thres=0.5, output='inference/output', save_txt=False, source='./inference/images/', update=False, view_img=False, weights=['yolov5m.pt']) Using CPU
Traceback (most recent call last): File "/home/mypc/anaconda3/lib/python3.7/tarfile.py", line 187, in nti n = int(s.strip() or "0", 8) ValueError: invalid literal for int() with base 8: 'py\nndarr'
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/home/mypc/anaconda3/lib/python3.7/tarfile.py", line 2289, in next tarinfo = self.tarinfo.fromtarfile(self) File "/home/mypc/anaconda3/lib/python3.7/tarfile.py", line 1095, in fromtarfile obj = cls.frombuf(buf, tarfile.encoding, tarfile.errors) File "/home/mypc/anaconda3/lib/python3.7/tarfile.py", line 1037, in frombuf chksum = nti(buf[148:156]) File "/home/mypc/anaconda3/lib/python3.7/tarfile.py", line 189, in nti raise InvalidHeaderError("invalid header") tarfile.InvalidHeaderError: invalid header
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/home/mypc/anaconda3/lib/python3.7/site-packages/torch/serialization.py", line 599, in _load return legacy_load(f) File "/home/mypc/anaconda3/lib/python3.7/site-packages/torch/serialization.py", line 507, in legacy_load with closing(tarfile.open(fileobj=f, mode='r:', format=tarfile.PAX_FORMAT)) as tar, \ File "/home/mypc/anaconda3/lib/python3.7/tarfile.py", line 1591, in open return func(name, filemode, fileobj, kwargs) File "/home/mypc/anaconda3/lib/python3.7/tarfile.py", line 1621, in taropen return cls(name, mode, fileobj, kwargs) File "/home/mypc/anaconda3/lib/python3.7/tarfile.py", line 1484, in init self.firstmember = self.next() File "/home/mypc/anaconda3/lib/python3.7/tarfile.py", line 2301, in next raise ReadError(str(e)) tarfile.ReadError: invalid header
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "detect.py", line 173, in
detect()
File "detect.py", line 35, in detect
model = attempt_load(weights, map_location=device) # load FP32 model
File "/home/mypc/Music/ultralytics_Yolov5/yolov5/models/experimental.py", line 137, in attempt_load
model.append(torch.load(w, map_location=map_location)['model'].float().fuse().eval()) # load FP32 model
File "/home/mypc/anaconda3/lib/python3.7/site-packages/torch/serialization.py", line 426, in load
return _load(f, map_location, pickle_module, **pickle_load_args)
File "/home/mypc/anaconda3/lib/python3.7/site-packages/torch/serialization.py", line 604, in _load
"{} is a zip archive (did you mean to use torch.jit.load()?)".format(f.name))
RuntimeError: yolov5m.pt is a zip archive (did you mean to use torch.jit.load()?)