我在安装过程中只有一个库安装报错,就是pycocotools库,报错Microsoft Visual C++ 14.0 or greater is required,对应Github库中作者强调了该错误信息是没有安装Visual C++ 2015 build tools,在文档中作者提供了一个下载地址,但是下载过程中总是报错。于是我找到了离线版本,下载链接
defparse_args():
parser = argparse.ArgumentParser()
parser.add_argument('--json',type=str, default='./data/annotations/annotations_all.json',help='COCO json label path')
parser.add_argument('--out-dir',type=str, default='./data/annotations',help='output path')
parser.add_argument('--ratios',
default=[0.9,0.1],
nargs='+',type=float,help='ratio for sub dataset, if set 2 number then will generate ''trainval + test (eg. "0.8 0.1 0.1" or "2 1 1"), if set 3 number ''then will generate train + val + test (eg. "0.85 0.15" or "2 1")')
parser.add_argument('--shuffle',
action='store_true',help='Whether to display in disorder')
parser.add_argument('--seed', default=2023,type=int,help='seed')
args = parser.parse_args()return args
defparse_args():
parser = argparse.ArgumentParser(
description='Distribution of categories and bbox instances')
parser.add_argument('--config', default='./configs/custom_dataset/yolov6_l_syncbn_fast_1xb8-100e_animal.py',help='config file path')
parser.add_argument('--val-dataset',
default=False,
action='store_true',help='The default train_dataset.''To change it to val_dataset, enter "--val-dataset"')
parser.add_argument('--class-name',
default=None,type=str,help='Display specific class, e.g., "bicycle"')
parser.add_argument('--area-rule',
default=None,type=int,
nargs='+',help='Redefine area rules,but no more than three numbers.'' e.g., 30 70 125')
parser.add_argument('--func',
default=None,type=str,
choices=['show_bbox_num','show_bbox_wh','show_bbox_wh_ratio','show_bbox_area'],help='Dataset analysis function selection.')
parser.add_argument('--out-dir',
default='./dataset_analysis',type=str,help='Output directory of dataset analysis visualization results,'' Save in "./dataset_analysis/" by default')
args = parser.parse_args()return args
defparse_args():
parser = argparse.ArgumentParser(description='Browse a dataset')
parser.add_argument('--config', default='./configs/custom_dataset/yolov6_l_syncbn_fast_1xb8-100e_animal.py',help='train config file path')
parser.add_argument('--phase','-p',
default='train',type=str,
choices=['train','test','val'],help='phase of dataset to visualize, accept "train" "test" and "val".'' Defaults to "train".')
parser.add_argument('--mode','-m',
default='transformed',type=str,
choices=['original','transformed','pipeline'],help='display mode; display original pictures or ''transformed pictures or comparison pictures. "original" ''means show images load from disk; "transformed" means ''to show images after transformed; "pipeline" means show all ''the intermediate images. Defaults to "transformed".')
parser.add_argument('--out-dir',
default='output',type=str,help='If there is no display interface, you can save it.')
parser.add_argument('--not-show', default=False, action='store_true')
parser.add_argument('--show-number','-n',type=int,
default=sys.maxsize,help='number of images selected to visualize, ''must bigger than 0. if the number is bigger than length ''of dataset, show all the images in dataset; ''default "sys.maxsize", show all images in dataset')
parser.add_argument('--show-interval','-i',type=float,
default=3,help='the interval of show (s)')
parser.add_argument('--cfg-options',
nargs='+',
action=DictAction,help='override some settings in the used config, the key-value pair ''in xxx=yyy format will be merged into config file. If the value to ''be overwritten is a list, it should be like key="[a,b]" or key=a,b ''It also allows nested list/tuple values, e.g. key="[(a,b),(c,d)]" ''Note that the quotation marks are necessary and that no white space ''is allowed.')
args = parser.parse_args()return args
defparse_args():
parser = argparse.ArgumentParser(description='Train a detector')
parser.add_argument('--config',default='./configs/custom_dataset/yolov6_l_syncbn_fast_1xb8-100e_animal.py',help='train config file path')
parser.add_argument('--work-dir',help='the dir to save logs and models')
parser.add_argument('--amp',
action='store_true',
default=False,help='enable automatic-mixed-precision training')
parser.add_argument('--resume',
nargs='?',type=str,
const='auto',help='If specify checkpoint path, resume from it, while if not ''specify, try to auto resume from the latest checkpoint ''in the work directory.')
parser.add_argument('--cfg-options',
nargs='+',
action=DictAction,help='override some settings in the used config, the key-value pair ''in xxx=yyy format will be merged into config file. If the value to ''be overwritten is a list, it should be like key="[a,b]" or key=a,b ''It also allows nested list/tuple values, e.g. key="[(a,b),(c,d)]" ''Note that the quotation marks are necessary and that no white space ''is allowed.')
parser.add_argument('--launcher',
choices=['none','pytorch','slurm','mpi'],
default='none',help='job launcher')
parser.add_argument('--local_rank',type=int, default=0)
args = parser.parse_args()if'LOCAL_RANK'notin os.environ:
os.environ['LOCAL_RANK']=str(args.local_rank)return args
运行后可以在wandb网页或者tensorboard中看到训练的具体信息
下面是 1 x 2080Ti、batch size = 8,训练100 epoch 最佳精度权重work_dirs\best_coco_bbox_mAP_epoch_97 得出来的精度:
defparse_args():
parser = ArgumentParser()
parser.add_argument('--img', default='./data/images/Image_20230621152815633.bmp',help='Image path, include image file, dir and URL.')
parser.add_argument('--config', default='./configs/custom_dataset/yolov6_l_syncbn_fast_1xb8-100e_animal.py',help='Config file')
parser.add_argument('--checkpoint', default='./work_dirs/best_coco_bbox_mAP_epoch_97.pth',help='Checkpoint file')
parser.add_argument('--out-dir', default='./output',help='Path to output file')
parser.add_argument('--device', default='cpu',help='Device used for inference')
parser.add_argument('--show', action='store_true',help='Show the detection results')
parser.add_argument('--deploy',
action='store_true',help='Switch model to deployment mode')
parser.add_argument('--tta',
action='store_true',help='Whether to use test time augmentation')
parser.add_argument('--score-thr',type=float, default=0.3,help='Bbox score threshold')
parser.add_argument('--class-name',
nargs='+',type=str,help='Only Save those classes if set')
parser.add_argument('--to-labelme',
action='store_true',help='Output labelme style label file')
args = parser.parse_args()return args
git提交代码的时候,报错
remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for informa…