wudashuo / yolov5

YOLOv5 汉化版,保持官方同步更新
GNU General Public License v3.0
445 stars 100 forks source link

detect后图片输出无结果 #2

Closed jczhang02 closed 3 years ago

jczhang02 commented 3 years ago

❔Question

在执行detect.py后,图片没有lable

wudashuo commented 3 years ago
  1. 如果系统是Windows的话,已经确定是有问题的,可以尝试降级pytorch至1.6版本,一般来说能解决问题。
  2. 如果是Linux或者MacOS的话,先试一下检测摄像头或者流媒体有没有问题,--source 0 或者--source rtsp://xxxxxxxxx,如果流媒体或者摄像头没问题,但是检测本地图片和视频检测不到,那么在这个else语句下添加cudnn.benchmark = True。 这个不是正确的解决方案,只能让你检测到东西,检测结果会损失严重。
  3. 最好检查一下依赖是否符合requirements.txt里的要求, 直接pip3 install -r requirements.txt,环境配对了一般没问题的。
jczhang02 commented 3 years ago

能否贴下else语句 我无法打开连接 另外,我已经检查了我系统环境,没有问题

pip3 install -r requirements.txt Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple Requirement already satisfied: Cython in /home/jczhang/anaconda3/lib/python3.8/site-packages (from -r requirements.txt (line 4)) (0.29.21) Requirement already satisfied: matplotlib>=3.2.2 in /home/jczhang/anaconda3/lib/python3.8/site-packages (from -r requirements.txt (line 5)) (3.3.2) Requirement already satisfied: numpy>=1.18.5 in /home/jczhang/anaconda3/lib/python3.8/site-packages (from -r requirements.txt (line 6)) (1.19.2) Requirement already satisfied: opencv-python>=4.1.2 in /home/jczhang/anaconda3/lib/python3.8/site-packages (from -r requirements.txt (line 7)) (4.5.1.48) Requirement already satisfied: Pillow in /home/jczhang/anaconda3/lib/python3.8/site-packages (from -r requirements.txt (line 8)) (8.0.1) Requirement already satisfied: PyYAML>=5.3.1 in /home/jczhang/anaconda3/lib/python3.8/site-packages (from -r requirements.txt (line 9)) (5.3.1) Requirement already satisfied: scipy>=1.4.1 in /home/jczhang/anaconda3/lib/python3.8/site-packages (from -r requirements.txt (line 10)) (1.5.2) Requirement already satisfied: tensorboard>=2.2 in /home/jczhang/anaconda3/lib/python3.8/site-packages (from -r requirements.txt (line 11)) (2.4.1) Requirement already satisfied: torch>=1.7.0 in /home/jczhang/anaconda3/lib/python3.8/site-packages (from -r requirements.txt (line 12)) (1.7.1+cu110) Requirement already satisfied: torchvision>=0.8.1 in /home/jczhang/anaconda3/lib/python3.8/site-packages (from -r requirements.txt (line 13)) (0.8.2+cu110) Requirement already satisfied: tqdm>=4.41.0 in /home/jczhang/anaconda3/lib/python3.8/site-packages (from -r requirements.txt (line 14)) (4.50.2) Requirement already satisfied: seaborn>=0.11.0 in /home/jczhang/anaconda3/lib/python3.8/site-packages (from -r requirements.txt (line 20)) (0.11.0) Requirement already satisfied: pandas in /home/jczhang/anaconda3/lib/python3.8/site-packages (from -r requirements.txt (line 21)) (1.1.3) Requirement already satisfied: thop in /home/jczhang/anaconda3/lib/python3.8/site-packages (from -r requirements.txt (line 29)) (0.0.31.post2005241907) Requirement already satisfied: pycocotools>=2.0 in /home/jczhang/anaconda3/lib/python3.8/site-packages (from -r requirements.txt (line 30)) (2.0.2) Requirement already satisfied: kiwisolver>=1.0.1 in /home/jczhang/anaconda3/lib/python3.8/site-packages (from matplotlib>=3.2.2->-r requirements.txt (line 5)) (1.3.0) Requirement already satisfied: certifi>=2020.06.20 in /home/jczhang/anaconda3/lib/python3.8/site-packages (from matplotlib>=3.2.2->-r requirements.txt (line 5)) (2020.6.20) Requirement already satisfied: cycler>=0.10 in /home/jczhang/anaconda3/lib/python3.8/site-packages (from matplotlib>=3.2.2->-r requirements.txt (line 5)) (0.10.0) Requirement already satisfied: pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.3 in /home/jczhang/anaconda3/lib/python3.8/site-packages (from matplotlib>=3.2.2->-r requirements.txt (line 5)) (2.4.7) Requirement already satisfied: python-dateutil>=2.1 in /home/jczhang/anaconda3/lib/python3.8/site-packages (from matplotlib>=3.2.2->-r requirements.txt (line 5)) (2.8.1) Requirement already satisfied: setuptools>=18.0 in /home/jczhang/anaconda3/lib/python3.8/site-packages (from pycocotools>=2.0->-r requirements.txt (line 30)) (50.3.1.post20201107) Requirement already satisfied: pytz>=2017.2 in /home/jczhang/anaconda3/lib/python3.8/site-packages (from pandas->-r requirements.txt (line 21)) (2020.1) Requirement already satisfied: markdown>=2.6.8 in /home/jczhang/anaconda3/lib/python3.8/site-packages (from tensorboard>=2.2->-r requirements.txt (line 11)) (3.3.3) Requirement already satisfied: protobuf>=3.6.0 in /home/jczhang/anaconda3/lib/python3.8/site-packages (from tensorboard>=2.2->-r requirements.txt (line 11)) (3.14.0) Requirement already satisfied: werkzeug>=0.11.15 in /home/jczhang/anaconda3/lib/python3.8/site-packages (from tensorboard>=2.2->-r requirements.txt (line 11)) (1.0.1) Requirement already satisfied: absl-py>=0.4 in /home/jczhang/anaconda3/lib/python3.8/site-packages (from tensorboard>=2.2->-r requirements.txt (line 11)) (0.11.0) Requirement already satisfied: google-auth-oauthlib<0.5,>=0.4.1 in /home/jczhang/anaconda3/lib/python3.8/site-packages (from tensorboard>=2.2->-r requirements.txt (line 11)) (0.4.2) Requirement already satisfied: requests<3,>=2.21.0 in /home/jczhang/anaconda3/lib/python3.8/site-packages (from tensorboard>=2.2->-r requirements.txt (line 11)) (2.24.0) Requirement already satisfied: six>=1.10.0 in /home/jczhang/anaconda3/lib/python3.8/site-packages (from tensorboard>=2.2->-r requirements.txt (line 11)) (1.15.0) Requirement already satisfied: wheel>=0.26 in /home/jczhang/anaconda3/lib/python3.8/site-packages (from tensorboard>=2.2->-r requirements.txt (line 11)) (0.35.1) Requirement already satisfied: tensorboard-plugin-wit>=1.6.0 in /home/jczhang/anaconda3/lib/python3.8/site-packages (from tensorboard>=2.2->-r requirements.txt (line 11)) (1.8.0) Requirement already satisfied: google-auth<2,>=1.6.3 in /home/jczhang/anaconda3/lib/python3.8/site-packages (from tensorboard>=2.2->-r requirements.txt (line 11)) (1.26.1) Requirement already satisfied: grpcio>=1.24.3 in /home/jczhang/anaconda3/lib/python3.8/site-packages (from tensorboard>=2.2->-r requirements.txt (line 11)) (1.32.0) Requirement already satisfied: typing-extensions in /home/jczhang/anaconda3/lib/python3.8/site-packages (from torch>=1.7.0->-r requirements.txt (line 12)) (3.7.4.3) Requirement already satisfied: rsa<5,>=3.1.4 in /home/jczhang/anaconda3/lib/python3.8/site-packages (from google-auth<2,>=1.6.3->tensorboard>=2.2->-r requirements.txt (line 11)) (4.7.1) Requirement already satisfied: cachetools<5.0,>=2.0.0 in /home/jczhang/anaconda3/lib/python3.8/site-packages (from google-auth<2,>=1.6.3->tensorboard>=2.2->-r requirements.txt (line 11)) (4.2.1) Requirement already satisfied: pyasn1-modules>=0.2.1 in /home/jczhang/anaconda3/lib/python3.8/site-packages (from google-auth<2,>=1.6.3->tensorboard>=2.2->-r requirements.txt (line 11)) (0.2.8) Requirement already satisfied: requests-oauthlib>=0.7.0 in /home/jczhang/anaconda3/lib/python3.8/site-packages (from google-auth-oauthlib<0.5,>=0.4.1->tensorboard>=2.2->-r requirements.txt (line 11)) (1.3.0) Requirement already satisfied: pyasn1<0.5.0,>=0.4.6 in /home/jczhang/anaconda3/lib/python3.8/site-packages (from pyasn1-modules>=0.2.1->google-auth<2,>=1.6.3->tensorboard>=2.2->-r requirements.txt (line 11)) (0.4.8) Requirement already satisfied: chardet<4,>=3.0.2 in /home/jczhang/anaconda3/lib/python3.8/site-packages (from requests<3,>=2.21.0->tensorboard>=2.2->-r requirements.txt (line 11)) (3.0.4) Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /home/jczhang/anaconda3/lib/python3.8/site-packages (from requests<3,>=2.21.0->tensorboard>=2.2->-r requirements.txt (line 11)) (1.25.11) Requirement already satisfied: idna<3,>=2.5 in /home/jczhang/anaconda3/lib/python3.8/site-packages (from requests<3,>=2.21.0->tensorboard>=2.2->-r requirements.txt (line 11)) (2.10) Requirement already satisfied: oauthlib>=3.0.0 in /home/jczhang/anaconda3/lib/python3.8/site-packages (from requests-oauthlib>=0.7.0->google-auth-oauthlib<0.5,>=0.4.1->tensorboard>=2.2->-r requirements.txt (line 11)) (3.1.0)

wudashuo commented 3 years ago

在detect.py 51行附近,原来的:

else:
    save_img = True
    dataset = LoadImages(source, img_size=imgsz, stride=stride)

改为:

else:
    cudnn.benchmark = True
    save_img = True
    dataset = LoadImages(source, img_size=imgsz, stride=stride)

改完检测应该会有结果,但是这个结果会很糟糕,我也没找到终极解决办法

jczhang02 commented 3 years ago

好 我已经修改完成 结果确实稍微差点

获取 Outlook for Androidhttps://aka.ms/ghei36


From: Troy @.> Sent: Monday, March 22, 2021 3:39:13 PM To: wudashuo/yolov5 @.> Cc: Flavius Buffon @.>; Mention @.> Subject: Re: [wudashuo/yolov5] detect后图片输出无结果 (#2)

在detect.py 51行附近,原来的:

else:

save_img = True

dataset = LoadImages(source, img_size=imgsz, stride=stride)

改为:

else:

cudnn.benchmark = True

save_img = True

dataset = LoadImages(source, img_size=imgsz, stride=stride)

改完检测应该会有结果,但是这个结果会很糟糕,我也没找到终极解决办法

― You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/wudashuo/yolov5/issues/2#issuecomment-803838655, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AKQEFEEZO56T4IU4JQMPFVLTE3X2DANCNFSM4ZSLYB3A.