当前位置:网站首页>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
边栏推荐
猜你喜欢
随机推荐
记录代码
npm WARN config global `--global`, `--local` are deprecated. Use `--location解决方案
【Acunetix-Forgot your password】
有奖征集|TaoCloud&宝德联合举办全闪POC!
ansible module --copy module
LeetCode每日一练 —— 20. 有效的括号
[kali-information collection] (1.8) ARP reconnaissance tool _Netdiscover
数字化转型中的低代码
划分训练集,验证集,测试集
Challenge LeetCode1000 questions in 365 days - Day 047 Design Circular Queue Circular Queue
看我如何用多线程,帮助运营小姐姐解决数据校对系统变慢!
QT笔记——Q_PROPERTY了解
配置mysql失败了,这是怎么回事呢?
翁恺C语言程序设计网课笔记合集
Deep Learning 100 Examples - Convolutional Neural Network (CNN) for mnist handwritten digit recognition
Create an application operation process using the kubesphere GUI
Mysql事务隔离级别与MVCC(多版本并发控制)
细学常用类,集合类,IO流
Oracle降低高水位
CCF paper conference IEEE how to query all articles of a conference journal