当前位置:网站首页>Graphical tools package yolov5 and generate executable files exe
Graphical tools package yolov5 and generate executable files exe
2022-07-07 03:22:00 【Master Ma】
Environmental Science
windows 10 64bit
auto-py-to-exe 2.10.1
Preface
Python Project packaging is a question that many novices often ask , Previous articles have also introduced how to use pyinstaller To package and generate executable files , It's just that the packaging process is based on the command line . The tool introduced in this article ,auto-py-to-exe, It is pyinstaller Of GUI edition , Be more friendly to new people , You can easily do it with a click of the mouse , that , Let's get started .
install
Use pip Direct installation
pip install auto-py-to-exe
Or pull the source code , Unzip and enter the root directory , perform
python setup.py install
Packaging example
This article uses the previous yolov5-pyqt5 Package the project , Here's a little bit of attention , If you are using python A virtual environment , It must be installed in this virtual environment auto-py-to-exe
After the project code is pulled down , modify main.py, take
self.device = select_device(self.opt.device)
Change it to
# gpu
self.device = torch.device('cuda:0')
# If only cpu Words , Change to
# self.device = torch.device('cpu')
Why should we change this ? This is mainly select_device The method uses subprocess, and pyinstaller Packing subprocess Method will report an error , If you go to modify subprocess Part of the code is a little troublesome , For the sake of simplicity , You won't call this method , For details, please refer to https://xugaoxiang.com/2019/12/04/pyqt5-4-pyinstaller/
then , open auto-py-to-exe, Script file selection yolov5-pyqt5 Under folder main.py, Select single file , That is, only one executable file is generated in the end
In the Advanced tab , Click on --hidden-import The plus sign on the right , Then fill in modles.yolo, otherwise , Generated exe The following error will be reported when running
Traceback (most recent call last):
File "detect_image.py", line 405, in <module>
File "detect_image.py", line 365, in main
File "detect_image.py", line 293, in detection_alertarea
File "detect_image.py", line 79, in __init__
File "models\experimental.py", line 137, in attempt_load
File "torch\serialization.py", line 594, in load
return _load(opened_zipfile, map_location, pickle_module, **pickle_load_args)
File "torch\serialization.py", line 853, in _load
result = unpickler.load()
ModuleNotFoundError: No module named 'models.yolo'
[12976] Failed to execute script detect_image
Others are similar No module named xxx Error of , It's the same solution
In the process of checking the configuration , The current command will display the corresponding pyinstaller Instructions , If you do not install auto-py-to-exe, Only installed pyinstaller, Then copy this command , It can also be packaged successfully
If no error is reported , project-generated exe The file will be placed in... By default C:\Users\ user name \output Next
Prepare the official model file yolov5s.pt, Put it in weights Under the folder , Then double click. exe file
Last , Select a test picture to test , Function is normal
Reference material
https://github.com/brentvollebregt/auto-py-to-exe
https://xugaoxiang.com/2019/12/04/pyqt5-4-pyinstaller/
https://github.com/xugaoxiang/yolov5-pyqt5
边栏推荐
- Laravel php artisan 自动生成Model+Migrate+Controller 命令大全
- Simple bubble sort
- [swift] learning notes (I) -- familiar with basic data types, coding styles, tuples, propositions
- 装饰设计企业网站管理系统源码(含手机版源码)
- 【Swift】学习笔记(一)——熟知 基础数据类型,编码风格,元组,主张
- Jerry's transmitter crashed after the receiver shut down [chapter]
- 硬件之OC、OD、推挽解释
- How-PIL-to-Tensor
- Uniapp adaptation problem
- IDEA重启后无法创建Servlet文件的解决方案
猜你喜欢
The first symposium on "quantum computing + application of financial technology" was successfully held in Beijing
从 1.5 开始搭建一个微服务框架——日志追踪 traceId
掘金量化:通过history方法获取数据,和新浪财经,雪球同用等比复权因子。不同于同花顺
杰理之在非蓝牙模式下,手机连接蓝牙不要跳回蓝牙模式处理方法【篇】
mos管实现主副电源自动切换电路,并且“零”压降,静态电流20uA
Appx code signing Guide
Use of tensorboard
“去虚向实”大潮下,百度智能云向实而生
Under the tide of "going from virtual to real", Baidu AI Cloud is born from real
Don't you know the relationship between JSP and servlet?
随机推荐
Stored procedures and functions (MySQL)
R数据分析:cox模型如何做预测,高分文章复现
杰理之在非蓝牙模式下,手机连接蓝牙不要跳回蓝牙模式处理方法【篇】
leetcode
校招行测笔试-数量关系
【安全的办公和生产力应用程序】上海道宁为您提供ONLYOFFICE下载、试用、教程
Flutter3.0了,小程序不止于移动应用跨端运行
CVPR 2022 最佳论文候选 | PIP: 6个惯性传感器实现全身动捕和受力估计
从0开始创建小程序
OC, OD, push-pull explanation of hardware
Lingyun going to sea | yidiantianxia & Huawei cloud: promoting the globalization of Chinese e-commerce enterprise brands
知识图谱构建全流程
【无标题】
When you go to the toilet, you can clearly explain the three Scheduling Strategies of scheduled tasks
Analysis of USB network card sending and receiving data
如何替换模型的骨干网络(backbone)
Cocos2d-x Box2D物理引擎编译设置
杰理之开 BLE 退出蓝牙模式卡机问题【篇】
leetcode-02(链表题)
Lost in the lock world of MySQL