当前位置:网站首页>Learning Experience Sharing Seven: YOLOv5 Code Chinese Comments
Learning Experience Sharing Seven: YOLOv5 Code Chinese Comments
2022-08-02 11:31:00 【Artificial Intelligence Algorithm Research Institute】
There are many friends who are learning YOLOv5 recently. In order to make it easier for everyone to better understand the source code, YOLOv5 is annotated in Chinese.Friends who need it can follow my WeChat official account:Artificial Intelligence AIAlgorithm Engineer after private message.
The following is a partial code example.
def main(opt):# 1, logging and wandb initialization# log initializationset_logging(RANK)if RANK in [-1, 0]:# can output all training opt parametersprint(colorstr('train: ') + ', '.join(f'{k}={v}' for k, v in vars(opt).items()))# This code is used to check if the code version is the latestcheck_git_status()# Used to check whether the required packages in requirements.txt are all satisfiedcheck_requirements(exclude=['thop'])# wandb logging initializationwandb_run = check_wandb_resume(opt)# 2. Determine whether to use the breakpoint to resume the training and load the parametersif opt.resume and not wandb_run:# Use breakpoints to continue training to read relevant parameters from last.pt# If resume is str, it will indicate that the path address of the model is passed in# If resume is True, use the get_lastest_run() function to find the latest weight file last.pt in the folder where runs areckpt = opt.resume if isinstance(opt.resume, str) else get_latest_run()assert os.path.isfile(ckpt), 'ERROR: --resume checkpoint does not exist' # check# The relevant opt parameters should also be replaced with the opt parameters in last.ptwith open(Path(ckpt).parent.parent / 'opt.yaml') as f:opt = argparse.Namespace(**yaml.safe_load(f)) # replaceopt.cfg, opt.weights, opt.resume = '', ckpt, True # reinstatelogger.info('Resuming training from %s' % ckpt) # printelse:# You can read relevant parameters from the file without using breakpoints to continue training# opt.hyp = opt.hyp or ('hyp.finetune.yaml' if opt.weights else 'hyp.scratch.yaml')opt.data, opt.cfg, opt.hyp = check_file(opt.data), check_file(opt.cfg), check_file(opt.hyp) # check files
If you think it is helpful to everyone, please like, collect, and follow. I will continue to provide reference for everyone to do experiments.Any questions are welcome to private message me.
If you need more program information and answer questions, please pay attention - WeChat public account: Artificial intelligence AIAlgorithm Engineer
边栏推荐
猜你喜欢
【Acunetix-Forgot your password】
使用kubesphere图形界面创建一个应用操作流程
Breaking the Boundary, Huawei's Storage Journey
阿里云数据存储生态计划发布,助力伙伴数据创新
5G网络切片技术
图形处理单元(GPU)的演进
[email protected] This version of tar is no longer supported, and will not receive"/>
npm WARN deprecated [email protected] This version of tar is no longer supported, and will not receive
C#/VB.NET 添加多行多列图片水印到Word文档
保姆级教程:写出自己的移动应用和小程序(篇二)
ssm网页访问数据库数据报错
随机推荐
STM32+MPU6050设计便携式Mini桌面时钟(自动调整时间显示方向)
ansible模块--yum模块
OLED的HAL库代码介绍及使用(stm32f1/I2C/HAL库版/100%一次点亮)
故障分析 | 一条 SELECT 语句跑崩了 MySQL ,怎么回事?
10份重磅报告 — 展望中国数字经济未来
智能手表前景如何?
小程序插件的生态丰富,加速开发建设效率
Excel dynamic chart production
Oracle降低高水位
Shell编程之条件语句
运行yum报错Error: Cannot retrieve metalink for reposit
华为eNSP(基础实验通信)
MapStruct
受邀出席Rust开发者大会|Rust如何助力量化高频交易?
暑期总结3
雷克萨斯,锁死的安全,挡不住的心寒
The sitcom "Re-Walking the Long March" was staged
bgp与mpls综合实验
ssm网页访问数据库数据报错
Swift中什么时候不能用 () 代替 Void 来使用