WongKinYiu / yolov7

Implementation of paper - YOLOv7: Trainable bag-of-freebies sets new state-of-the-art for real-time object detectors
GNU General Public License v3.0
13.36k stars 4.22k forks source link

No detections from model #884

Open chiragdeep01 opened 2 years ago

chiragdeep01 commented 2 years ago

I cloned the repo and created the enviroment. To test if everything was working i ran the detect script, the images get saved in the runs/detect folder but no detections are getting drawn. I also tried printing out the detection to check if the model was giving any detections or not but its not even giving out any predictions. Images are the inference images provided with the repo and the weights were downloaded when i ran the detect script. I also tried downloaded the same weights manually but still the results are same. I only installed pytorch differently by using: conda install pytorch==1.10.0 torchvision==0.11.0 torchaudio==0.10.0 cudatoolkit=11.3 -c pytorch -c conda-forge this is on the pytorch official website 123

andrearosasco commented 2 years ago

Had the same problem, let me know if you find a solution https://github.com/WongKinYiu/yolov7/issues/867 Have you tested older commits? Maybe they pushed some breaking changes. Which checkpoints did you load?

yulin010101 commented 2 years ago

I used the same way to install pytorch but didn't face this situation. Can you be more specific about the environment you are using?

andrearosasco commented 2 years ago

Hi @yulin010101, thanks for the help. I'll share my setup if it can help. First I tried to run it in my "default" ml Conda environment: an env with detectron, pytorch and a bunch of other packages useful for deep learning. Then, since I wasn't getting any detection I followed the procedure in the README and run it into a Docker container, but still nothing.

From @chiragdeep01 screenshot it looks like we are both on Windows if that can be of help

chiragdeep01 commented 2 years ago

I used the same way to install pytorch but didn't face this situation. Can you be more specific about the environment you are using?

Sorry for the late reply

python is 3.8.13 brotlipy 0.7.0 certifi 2022.9.14 cffi 1.15.1 charset-normalizer 2.0.4 colorama 0.4.5 contourpy 1.0.5 cryptography 37.0.1 cycler 0.11.0 fonttools 4.37.4 idna 3.3 kiwisolver 1.4.4 matplotlib 3.6.0 mkl-fft 1.3.1 mkl-random 1.2.2 mkl-service 2.4.0 numpy 1.23.1 opencv-python 4.6.0.66 packaging 21.3 pandas 1.5.0 Pillow 9.2.0 pip 22.2.2 pycparser 2.21 pyOpenSSL 22.0.0 pyparsing 3.0.9 PySocks 1.7.1 python-dateutil 2.8.2 pytz 2022.4 PyYAML 6.0 requests 2.28.1 scipy 1.9.1 seaborn 0.12.0 setuptools 63.4.1 six 1.16.0 torch 1.12.1 torchaudio 0.12.1 torchvision 0.13.1 tqdm 4.64.1 typing_extensions 4.3.0 urllib3 1.26.11 wheel 0.37.1 win-inet-pton 1.1.0 wincertstore 0.2

(yolo7) C:\Users\cdeep\python\yolov7>conda list cuda packages in environment at C:\Users\cdeep\Anaconda3\envs\yolo7:

Name Version Build Channel cudatoolkit 11.3.1 h59b6b97_2

so i tried with cpu and its working but still no results with gpu.

chiragdeep01 commented 2 years ago

@andrearosasco @yulin010101 Okay so i solved it the solution is you need to comment out the line 31 in detect.py fle : half = device.type != 'cpu' and in the next line set half = False so your final code should look like this: Uploading asdasdasd.png…

andrearosasco commented 2 years ago

Thank you very much! Why doesn't it work in half-precision though?

chiragdeep01 commented 2 years ago

@andrearosasco i have no idea :P

andrearosasco commented 2 years ago

@chiragdeep01 Haha alright, that's fine, it is still pretty fast. Maybe I'll look more into it if I'll need to speed it up further. Can I point you to this issue? https://github.com/WongKinYiu/yolov7/issues/935 We were trying to figure out some details about the implementation of the architectures.

chiragdeep01 commented 2 years ago

@andrearosasco sure

459737087 commented 1 year ago

it can't work. I've try