当前位置:网站首页>Some parameter settings and feature graph visualization of yolov5-6.0
Some parameter settings and feature graph visualization of yolov5-6.0
2022-06-26 04:48:00 【qq_ forty-one million six hundred and twenty-seven thousand six】
1、detect.py
def parse_opt():
parser = argparse.ArgumentParser()
# Model
parser.add_argument('--weights', nargs='+', type=str, default=ROOT / 'yolov5s.pt', help='model path(s)')
# parser.add_argument('--weights', nargs='+', type=str, default=ROOT / 'yolov5l.pt', help='model path(s)')
# need detect The file of : picture 、 video
parser.add_argument('--source', type=str, default=ROOT / 'data/images', help='file/dir/URL/glob, 0 for webcam')
# train dataset The label of
parser.add_argument('--data', type=str, default=ROOT / 'data/coco128.yaml', help='(optional) dataset.yaml path')
parser.add_argument('--imgsz', '--img', '--img-size', nargs='+', type=int, default=[640], help='inference size h,w')
# Believe is a class The threshold of
parser.add_argument('--conf-thres', type=float, default=0.25, help='confidence threshold')
# IoU
parser.add_argument('--iou-thres', type=float, default=0.45, help='NMS IoU threshold')
parser.add_argument('--max-det', type=int, default=1000, help='maximum detections per image')
parser.add_argument('--device', default='', help='cuda device, i.e. 0 or 0,1,2,3 or cpu')
parser.add_argument('--view-img', action='store_true', help='show results')
parser.add_argument('--save-txt', action='store_true', help='save results to *.txt')
parser.add_argument('--save-conf', action='store_true', help='save confidences in --save-txt labels')
parser.add_argument('--save-crop', action='store_true', help='save cropped prediction boxes')
parser.add_argument('--nosave', action='store_true', help='do not save images/videos')
# Just look at some classes
parser.add_argument('--classes', nargs='+', type=int, help='filter by class: --classes 0, or --classes 0 2 3')
parser.add_argument('--agnostic-nms', action='store_true', help='class-agnostic NMS')
# Model enhancement , If specified, it is set to True
parser.add_argument('--augment', action='store_true', help='augmented inference')
parser.add_argument('--visualize', action='store_true', help='visualize features')
# Remove unnecessary parts of the network model
parser.add_argument('--update', action='store_true', help='update all models')
# Saved file name
parser.add_argument('--project', default=ROOT / 'runs/detect', help='save results to project/name')
parser.add_argument('--name', default='exp', help='save results to project/name')
# Whether to put it in a separate folder True:do not increment
parser.add_argument('--exist-ok', action='store_true', help='existing project/name ok, do not increment')
parser.add_argument('--line-thickness', default=3, type=int, help='bounding box thickness (pixels)')
parser.add_argument('--hide-labels', default=False, action='store_true', help='hide labels')
parser.add_argument('--hide-conf', default=False, action='store_true', help='hide confidences')
parser.add_argument('--half', action='store_true', help='use FP16 half-precision inference')
parser.add_argument('--dnn', action='store_true', help='use OpenCV DNN for ONNX inference')
opt = parser.parse_args()
opt.imgsz *= 2 if len(opt.imgsz) == 1 else 1 # expand
print_args(FILE.stem, opt)
return opt
2、train.py
def parse_opt(known=False):
parser = argparse.ArgumentParser()
# Trained models , Set to blank to train from the beginning
parser.add_argument('--weights', type=str, default=ROOT / 'yolov5s.pt', help='initial weights path')
# Parameter configuration of the model , Such as models/yolov5s.yaml
parser.add_argument('--cfg', type=str, default='', help='model.yaml path')
# dataset path( Label file )
parser.add_argument('--data', type=str, default=ROOT / 'data/coco128.yaml', help='dataset.yaml path')
# Hyperparameters , Fine tune the model parameters
parser.add_argument('--hyp', type=str, default=ROOT / 'data/hyps/hyp.scratch.yaml', help='hyperparameters path')
# Number of training rounds
parser.add_argument('--epochs', type=int, default=300)
# --batch-size
parser.add_argument('--batch-size', type=int, default=16, help='total batch size for all GPUs, -1 for autobatch')
# img-size
parser.add_argument('--imgsz', '--img', '--img-size', type=int, default=640, help='train, val image size (pixels)')
# Non matrix size image processing
parser.add_argument('--rect', action='store_true', help='rectangular training')
# Whether to continue training from the latest training model , default="path"( Complete configuration is required )
parser.add_argument('--resume', nargs='?', const=True, default=False, help='resume most recent training')
# Save only the last training model ?
parser.add_argument('--nosave', action='store_true', help='only save final checkpoint')
# Only test the last training model ?
parser.add_argument('--noval', action='store_true', help='only validate final epoch')
# Anchor point
parser.add_argument('--noautoanchor', action='store_true', help='disable AutoAnchor')
# “ evolution ” Hyperparameters
parser.add_argument('--evolve', type=int, nargs='?', const=300, help='evolve hyperparameters for x generations')
# ---- Never mind ----
parser.add_argument('--bucket', type=str, default='', help='gsutil bucket')
# Whether to cache the picture , Easy to train
parser.add_argument('--cache', type=str, nargs='?', const='ram', help='--cache images in "ram" (default) or "disk"')
# Add some weight to those who failed in the previous round of tests , The effect is hard to say
parser.add_argument('--image-weights', action='store_true', help='use weighted image selection for training')
parser.add_argument('--device', default='', help='cuda device, i.e. 0 or 0,1,2,3 or cpu')
# Picture size transformation
parser.add_argument('--multi-scale', action='store_true', help='vary img-size +/- 50%%')
# Whether the training data set is single category or multi category
parser.add_argument('--single-cls', action='store_true', help='train multi-class data as single-class')
# Optimizer settings
parser.add_argument('--optimizer', type=str, choices=['SGD', 'Adam', 'AdamW'], default='SGD', help='optimizer')
# many GPU
parser.add_argument('--sync-bn', action='store_true', help='use SyncBatchNorm, only available in DDP mode')
# Number of processes
# parser.add_argument('--workers', type=int, default=8, help='max dataloader workers (per RANK in DDP mode)')
parser.add_argument('--workers', type=int, default=0, help='max dataloader workers (per RANK in DDP mode)')
# Save the path
parser.add_argument('--project', default=ROOT / 'runs/train', help='save to project/name')
parser.add_argument('--name', default='exp', help='save to project/name')
parser.add_argument('--exist-ok', action='store_true', help='existing project/name ok, do not increment')
# Data processing
parser.add_argument('--quad', action='store_true', help='quad dataloader')
# learning rate
parser.add_argument('--linear-lr', action='store_true', help='linear LR')
# Label smoothing
parser.add_argument('--label-smoothing', type=float, default=0.0, help='Label smoothing epsilon')
parser.add_argument('--patience', type=int, default=100, help='EarlyStopping patience (epochs without improvement)')
parser.add_argument('--freeze', nargs='+', type=int, default=[0], help='Freeze layers: backbone=10, first3=0 1 2')
# preservation W$B journal
parser.add_argument('--save-period', type=int, default=-1, help='Save checkpoint every x epochs (disabled if < 1)')
parser.add_argument('--local_rank', type=int, default=-1, help='DDP parameter, do not modify')
# Weights & Biases arguments
parser.add_argument('--entity', default=None, help='W&B: Entity')
parser.add_argument('--upload_dataset', nargs='?', const=True, default=False, help='W&B: Upload data, "val" option')
parser.add_argument('--bbox_interval', type=int, default=-1, help='W&B: Set bounding-box image logging interval')
parser.add_argument('--artifact_alias', type=str, default='latest', help='W&B: Version of dataset artifact to use')
opt = parser.parse_known_args()[0] if known else parser.parse_args()
return opt
3、 Environment configuration 】YOLOV5 View the characteristic diagram
4、yolov5 Visual feature map and test results
5、YOLO-V5 GRADCAM
6、YOLOv5 Target detection Grad-CAM Thermodynamic diagram visualization
边栏推荐
- Tips for using idea
- Database design (I)
- 1.24 learning summary
- Svn correlation
- Alipay failed to verify the signature (sandbox test indicates fishing risk?) [original]
- 1.12 learning summary
- LeetCode 94. Middle order traversal of binary tree
- 条件查询
- [H5 development] 02 take you to develop H5 list page ~ including query, reset and submission functions
- Thymeleaf data echo, single selection backfill, drop-down backfill, time frame backfill
猜你喜欢
0622 horse palm fell 9%
Performance test comparison between PHP framework jsnpp and thinkphp6
Nabicat connection: local MySQL & cloud service MySQL and error reporting
Motivational skills for achieving goals
Database design (I)
SixTool-多功能多合一代挂助手源码
NVM installation and use and NPM package installation failure record
A new paradigm for large model application: unified feature representation optimization (UFO)
Multipass Chinese document - remote use of multipass
Text horizontal alignment attribute text align and element vertical alignment attribute vertical align
随机推荐
Rdkit chemical formula molecular formula search
Dameng database backup and restore
Navicat connects the pit of shardingsphere sub table and sub library plug-ins
Simple personal summary of tp6 multi application deployment -- Part I [original]
numpy 数据输入输出
2022 talent strategic transformation under the development trend of digital economy
Comment enregistrer une image dans une applet Wechat
Redis cache message queue
Thinkphp6 parsing QR code
Stm8 MCU ADC sampling function is triggered by timer
2021-01-31
Modify the number of Oracle connections
Multipass中文文档-设置驱动
1.19 learning summary
How can the intelligent transformation path of manufacturing enterprises be broken due to talent shortage and high cost?
Compiling and installing phpredis extension on MAC
An unexpected attempt (Imperial CMS list template filters spaces and newlines in smalltext introduction)
2022.1.23
Sixtool- source code of multi-functional and all in one generation hanging assistant
08_ Spingboot integrated redis