
이 질문에 대해서는 Stack Overflow에서 이 플랫폼을 참조했습니다.
나는 그것을 따르려고 노력하고 있습니다TensorFlow 및 Flask를 사용하여 객체 감지 API를 구축하는 방법비디오(YouTube에서).
GitHub 리포지토리를 복제한 다음 가중치 파일을 다운로드했습니다. python 3.6.0
(파일에 있던 TensorFlow 버전 2.2와의 비호환으로 인해 Python 3.9.2에서 오류가 발생했기 때문입니다 ) 를 사용하여 가상 환경도 만들었습니다 requirements.txt
.
그런데 다음 명령으로 가중치를 로드하려고 했더니,
python load_weights.py
이 오류가 발생합니다.
<module>의 파일 "load_weights.py", 4행 yolov3_tf2.models에서 YoloV3, YoloV3Tiny 가져오기 역추적(가장 최근 호출 마지막): <module>의 파일 "load_weights.py", 4행 yolov3_tf2.models에서 YoloV3, YoloV3Tiny 가져오기 파일 "E:\Example4\Object-Detection-API\yolov3_tf2\models.py", 23행, <module>에 있음 .utils import Broadcast_iou에서 <모듈>의 파일 "E:\Example4\Object-Detection-API\yolov3_tf2\utils.py", 5행 seaborn import color_palette에서 <모듈>의 파일 "E:\Example4\Object-Detection-API\venv\lib\site-packages\seaborn\__init__.py", 2행 .rcmod import * # noqa: F401,F403 <모듈>의 파일 "E:\Example4\Object-Detection-API\venv\lib\site-packages\seaborn\rcmod.py", 5행 matplotlib를 mpl로 가져오기 <module>의 파일 "E:\Example4\Object-Detection-API\venv\lib\site-packages\matplotlib\__init__.py", 107행 에서 . cbook 가져오기, rcsetup <모듈>의 파일 "E:\Example4\Object-Detection-API\venv\lib\site-packages\matplotlib\rcsetup.py", 28행 matplotlib.fontconfig_pattern에서 importparse_fontconfig_pattern 파일 "E:\Example4\Object-Detection-API\venv\lib\site-packages\matplotlib\fontconfig_pattern.py", 15행, <module>에 있음 pyparsing 가져오기(Literal, ZeroOrMore, Optional, Regex, StringEnd, 파일 "E:\Example4\Object-Detection-API\venv\lib\site-packages\pyparsing\__init__.py", 130행, <module>에 있음 __버전__ = __버전_정보__.__버전__ AttributeError: 'version_info' 개체에 '__version__' 속성이 없습니다.
늘 그렇듯이 중요한 부분은 끝에 있습니다. 마지막 줄은 제목에 표시된 오류입니다. 나는 Stack Overflow와 웹의 다른 곳에서 이것을 찾으려고 노력했지만(Google로 검색) 나에게 맞는 것을 찾을 수 없었습니다.
답변엔큐보스에 의해python 라이브러리 pyparsing의 알 수 없는 버전
Stack Overflow에서 라이브러리를 변경하라고 했습니다 pyparsing
.
명령을 사용하여 pyparsing 버전을 확인했는데 pip show pyparsing
다음과 같은 결과가 표시되었습니다.
WARNING: Ignoring invalid distribution -ensorflow (e:\hassan\example4\object-detection-api\venv\lib\site-packages)
Name: pyparsing
Version: 3.0.7
Summary: Python parsing module
Home-page: https://github.com/pyparsing/pyparsing/
Author: Paul McGuire
Author-email: [email protected]
License: MIT License
Location: e:\example4\object-detection-api\venv\lib\site-packages
Requires:
Required-by: matplotlib
그런 다음 다음 명령을 사용하여 pyparsing 버전 3.0.7을 설치하려고했습니다.
pip install pyparsing==3.0.7
그런데 이런 문자를 받았는데,
Requirement already satisfied: pyparsing==3.0.7 in e:\example4\object-detection-api\venv\lib\site-packages (3.0.7)
WARNING: You are using pip version 21.3.1; however, version 22.0.3 is available.
You should consider upgrading via the 'E:\Example4\Object-Detection-API\venv\Scripts\python.exe -m pip install --upgrade pip' command.
또한 pyparsing을 제거하고 지정된 버전을 다시 설치하려고 시도했지만 문제는 여전히 지속되었습니다.
tensorflow-gpu
또 다른 해결책은 GitHub 저장소에 제공된 것을 설치하라고 조언했습니다 .
pip install -r requirements-gpu.txt
나는 이것을 시도했다; 그러나 이것도 작동하지 않았습니다. 또한 TensorFlow를 제거하고 다시 설치하려고 시도했지만 다시 동일한 오류가 지속되었습니다.
나는 또한 이것을 사용하여 내 pip를 업그레이드하려고 시도했습니다.
python -m pip install --upgrade pip
이것은 나에게 다음과 같은 메시지를 보여주었습니다.
Requirement already satisfied: pip in e:\hassan\semester 8\research\example4\object-detection-api\venv\lib\site-packages (21.3.1)
그러나 마지막에는 여전히 새 버전을 사용할 수 있다는 메시지가 표시됩니다(그러나 설치가 되지 않습니다. 이유가 무엇인지 모르겠습니다).
WARNING: You are using pip version 21.3.1; however, version 22.0.3 is available.
You should consider upgrading via the 'E:\Example4\Object-Detection-API\venv\Scripts\python.exe -m pip install --upgrade pip' command.
이 오류를 어떻게 해결할 수 있나요 version
?