当前位置:网站首页>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
边栏推荐
- 做软件测试学历重要还是能力重要
- JWT token authentication verification
- Comment enregistrer une image dans une applet Wechat
- 2022.2.15
- Essential foundation of programming - Summary of written interview examination sites - computer network (1) overview
- Selection of programming language
- Navicat connects the pit of shardingsphere sub table and sub library plug-ins
- Numpy data input / output
- PHP has the problem of using strtotime to obtain time in months and months [original]
- I like you!
猜你喜欢

1.11 learning summary
![There is no response to redirection and jump in the laravel constructor [original]](/img/6b/5d9d7fe1348892d01a87d04f122dfc.jpg)
There is no response to redirection and jump in the laravel constructor [original]

2022.1.24

文件上传与安全狗

Rsync common error messages (common errors on the window)

NVM installation and use and NPM package installation failure record

Essential foundation of programming - Summary of written interview examination sites - computer network (1) overview
![[H5 development] 02 take you to develop H5 list page ~ including query, reset and submission functions](/img/39/64df931d5ec54d7d19ae444fa372ba.jpg)
[H5 development] 02 take you to develop H5 list page ~ including query, reset and submission functions

Nabicat连接:本地Mysql&&云服务Mysql以及报错

Record a circular reference problem
随机推荐
Hash problem
Be a hard worker from today on
1.14 learning summary
[H5 development] 01 take you to experience H5 development from a simple page ~ the whole page implementation process from static page to interface adjustment manual teaching
PHP get mobile number operator
Minecraft 1.16.5 biochemical 8 module 1.9 version 1.18 version synchronization
Navicat connects the pit of shardingsphere sub table and sub library plug-ins
Wechat applet exits the applet (navigator and api--wx.exitminiprogram)
Multipass中文文档-远程使用Multipass
Rsync common error messages (common errors on the window)
Zhimeng CMS will file a lawsuit against infringing websites
2021-01-31
Is education important or ability important in software testing
Create alicloud test instances
Text horizontal alignment attribute text align and element vertical alignment attribute vertical align
JWT token authentication verification
0622-马棕榈跌9%
Dameng database backup and restore
2022.1.23
LISP programming language