Skip to content
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

根据Pytorch模型测试配置流程,运行python detect_plate.py报错 #45

Open
lex7061 opened this issue Feb 16, 2022 · 4 comments

Comments

@lex7061
Copy link

lex7061 commented Feb 16, 2022

1、源程序build完直接运行报错如下:

image

2、修改了文件路径后运行报错如下:

D:\InstallationDir\anaconda\python.exe E:/lxx/workProjects/uniappHyperLPR/License-Plate-Detector/detect_plate.py
Namespace(weights='runs/train/exp/weights/last.pt', image='data/images/test.jpg', img_size=640)
Traceback (most recent call last):
  File "D:\InstallationDir\anaconda\lib\site-packages\urllib3\connectionpool.py", line 700, in urlopen
    self._prepare_proxy(conn)
  File "D:\InstallationDir\anaconda\lib\site-packages\urllib3\connectionpool.py", line 994, in _prepare_proxy
    conn.connect()
  File "D:\InstallationDir\anaconda\lib\site-packages\urllib3\connection.py", line 364, in connect
    conn = self._connect_tls_proxy(hostname, conn)
  File "D:\InstallationDir\anaconda\lib\site-packages\urllib3\connection.py", line 501, in _connect_tls_proxy
    socket = ssl_wrap_socket(
  File "D:\InstallationDir\anaconda\lib\site-packages\urllib3\util\ssl_.py", line 453, in ssl_wrap_socket
    ssl_sock = _ssl_wrap_socket_impl(sock, context, tls_in_tls)
  File "D:\InstallationDir\anaconda\lib\site-packages\urllib3\util\ssl_.py", line 495, in _ssl_wrap_socket_impl
    return ssl_context.wrap_socket(sock)
  File "D:\InstallationDir\anaconda\lib\ssl.py", line 500, in wrap_socket
    return self.sslsocket_class._create(
  File "D:\InstallationDir\anaconda\lib\ssl.py", line 1040, in _create
    self.do_handshake()
  File "D:\InstallationDir\anaconda\lib\ssl.py", line 1309, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:1129)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\InstallationDir\anaconda\lib\site-packages\requests\adapters.py", line 440, in send
    resp = conn.urlopen(
  File "D:\InstallationDir\anaconda\lib\site-packages\urllib3\connectionpool.py", line 785, in urlopen
    retries = retries.increment(
  File "D:\InstallationDir\anaconda\lib\site-packages\urllib3\util\retry.py", line 592, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='api.github.com', port=443): Max retries exceeded with url: /repos/ultralytics/yolov5/releases/latest (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1129)')))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "E:\lxx\workProjects\uniappHyperLPR\License-Plate-Detector\utils\google_utils.py", line 25, in attempt_download
    response = requests.get(f'https://api.github.com/repos/{repo}/releases/latest').json()  # github api
  File "D:\InstallationDir\anaconda\lib\site-packages\requests\api.py", line 75, in get
    return request('get', url, params=params, **kwargs)
  File "D:\InstallationDir\anaconda\lib\site-packages\requests\api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "D:\InstallationDir\anaconda\lib\site-packages\requests\sessions.py", line 529, in request
    resp = self.send(prep, **send_kwargs)
  File "D:\InstallationDir\anaconda\lib\site-packages\requests\sessions.py", line 645, in send
    r = adapter.send(request, **kwargs)
  File "D:\InstallationDir\anaconda\lib\site-packages\requests\adapters.py", line 517, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='api.github.com', port=443): Max retries exceeded with url: /repos/ultralytics/yolov5/releases/latest (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1129)')))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "E:\lxx\workProjects\uniappHyperLPR\License-Plate-Detector\detect_plate.py", line 172, in <module>
    model = load_model(opt.weights, device)
  File "E:\lxx\workProjects\uniappHyperLPR\License-Plate-Detector\detect_plate.py", line 25, in load_model
    model = attempt_load(weights, map_location=device)  # load FP32 model
  File "E:\lxx\workProjects\uniappHyperLPR\License-Plate-Detector\models\experimental.py", line 117, in attempt_load
    attempt_download(w)
  File "E:\lxx\workProjects\uniappHyperLPR\License-Plate-Detector\utils\google_utils.py", line 30, in attempt_download
    tag = subprocess.check_output('git tag', shell=True).decode('utf-8').split('\n')[-2]
IndexError: list index out of range

进程已结束,退出代码1

@Jinkham
Copy link
Member

Jinkham commented Feb 16, 2022

1.文件路径不对,上面的路径改成自己图片的路径。2.你的Python版本是什么,感觉还是路径或者文件编码格式的问题,windows下路径用“\”或者"/"。

@lex7061
Copy link
Author

lex7061 commented Feb 17, 2022

1、文件路径采用的绝对路径,图片是CCPD的
image
2、python版本3.9.10,是通过anaconda配置的环境【windows11】
image
3、当前配置下运行报错信息如下:

D:\InstallationDir\anaconda\python.exe E:/lxx/workProjects/uniappHyperLPR/License-Plate-Detector/detect_plate.py
Namespace(weights='runs/train/exp/weights/last.pt', image='data/images/test.jpg', img_size=640)
Traceback (most recent call last):
  File "D:\InstallationDir\anaconda\lib\site-packages\urllib3\connectionpool.py", line 700, in urlopen
    self._prepare_proxy(conn)
  File "D:\InstallationDir\anaconda\lib\site-packages\urllib3\connectionpool.py", line 994, in _prepare_proxy
    conn.connect()
  File "D:\InstallationDir\anaconda\lib\site-packages\urllib3\connection.py", line 364, in connect
    conn = self._connect_tls_proxy(hostname, conn)
  File "D:\InstallationDir\anaconda\lib\site-packages\urllib3\connection.py", line 501, in _connect_tls_proxy
    socket = ssl_wrap_socket(
  File "D:\InstallationDir\anaconda\lib\site-packages\urllib3\util\ssl_.py", line 453, in ssl_wrap_socket
    ssl_sock = _ssl_wrap_socket_impl(sock, context, tls_in_tls)
  File "D:\InstallationDir\anaconda\lib\site-packages\urllib3\util\ssl_.py", line 495, in _ssl_wrap_socket_impl
    return ssl_context.wrap_socket(sock)
  File "D:\InstallationDir\anaconda\lib\ssl.py", line 500, in wrap_socket
    return self.sslsocket_class._create(
  File "D:\InstallationDir\anaconda\lib\ssl.py", line 1040, in _create
    self.do_handshake()
  File "D:\InstallationDir\anaconda\lib\ssl.py", line 1309, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:1129)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\InstallationDir\anaconda\lib\site-packages\requests\adapters.py", line 440, in send
    resp = conn.urlopen(
  File "D:\InstallationDir\anaconda\lib\site-packages\urllib3\connectionpool.py", line 785, in urlopen
    retries = retries.increment(
  File "D:\InstallationDir\anaconda\lib\site-packages\urllib3\util\retry.py", line 592, in increment
    raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='api.github.com', port=443): Max retries exceeded with url: /repos/ultralytics/yolov5/releases/latest (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1129)')))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "E:\lxx\workProjects\uniappHyperLPR\License-Plate-Detector\utils\google_utils.py", line 25, in attempt_download
    response = requests.get(f'https://api.github.com/repos/{repo}/releases/latest').json()  # github api
  File "D:\InstallationDir\anaconda\lib\site-packages\requests\api.py", line 75, in get
    return request('get', url, params=params, **kwargs)
  File "D:\InstallationDir\anaconda\lib\site-packages\requests\api.py", line 61, in request
    return session.request(method=method, url=url, **kwargs)
  File "D:\InstallationDir\anaconda\lib\site-packages\requests\sessions.py", line 529, in request
    resp = self.send(prep, **send_kwargs)
  File "D:\InstallationDir\anaconda\lib\site-packages\requests\sessions.py", line 645, in send
    r = adapter.send(request, **kwargs)
  File "D:\InstallationDir\anaconda\lib\site-packages\requests\adapters.py", line 517, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='api.github.com', port=443): Max retries exceeded with url: /repos/ultralytics/yolov5/releases/latest (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1129)')))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "E:\lxx\workProjects\uniappHyperLPR\License-Plate-Detector\detect_plate.py", line 176, in <module>
    model = load_model(opt.weights, device)
  File "E:\lxx\workProjects\uniappHyperLPR\License-Plate-Detector\detect_plate.py", line 25, in load_model
    model = attempt_load(weights, map_location=device)  # load FP32 model
  File "E:\lxx\workProjects\uniappHyperLPR\License-Plate-Detector\models\experimental.py", line 117, in attempt_load
    attempt_download(w)
  File "E:\lxx\workProjects\uniappHyperLPR\License-Plate-Detector\utils\google_utils.py", line 30, in attempt_download
    tag = subprocess.check_output('git tag', shell=True).decode('utf-8').split('\n')[-2]
IndexError: list index out of range

进程已结束,退出代码1

@Mr-ind1fferent
Copy link

你好,请问预测的时候应该修改哪些呢?

@Mr-ind1fferent
Copy link

你好,请问预测的时候应该修改哪些呢?

image
这是我的报错

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants