当前位置:网站首页>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 filesIf 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
边栏推荐
猜你喜欢
随机推荐
一体化在线政务服务平台,小程序容器技术加速建设步伐
365天挑战LeetCode1000题——Day 047 设计循环队列 循环队列
配置mysql失败了,这是怎么回事呢?
Excel动态图制作
关于#oracle#的问题,如何解决?
C#/VB.NET to add more lines more columns image watermark into the Word document
21天学习挑战赛--第一天打卡(屏幕密度)
Oracle根据时间查询
ansible模块--yum模块
Nanny Level Tutorial: Write Your Own Mobile Apps and Mini Programs (Part 2)
npm WARN config global `--global`, `--local` are deprecated. Use `--location解决方案
Geoffery Hinton: The Next Big Thing in Deep Learning
npm install报错npm ERR Could not resolve dependency npm ERR peer
idea常用插件
SQL 数据更新
Running yum reports Error: Cannot retrieve metalink for reposit
有奖征集|TaoCloud&宝德联合举办全闪POC!
受邀出席Rust开发者大会|Rust如何助力量化高频交易?
Mysql事务隔离级别与MVCC(多版本并发控制)
保姆级教程:写出自己的移动应用和小程序(篇二)









