SSTato / YOLOv7_obb

Rotating object detection using YOLOv7 and CSL.
GNU General Public License v3.0
26 stars 3 forks source link

hyperparameter file #17

Closed zzbbzz626 closed 11 months ago

zzbbzz626 commented 12 months ago

Your implementation code is very helpful! Could you share the hyperparameter file, please?

SSTato commented 11 months ago

Just use the default hyperparameters in Yolov7. I have used hyperparameter evolution before, but there are too many versions and I can't find the file. image

or

image

zzbbzz626 commented 11 months ago

And another question for you, why is it that when using train_ota.py, it keeps defaulting to using migration training? I don't use --weights in my parameter settings.

Here are my parameters: def parse_opt(known=False): parser = argparse.ArgumentParser() parser.add_argument('--weights', type=str, default='', help='initial weights path') parser.add_argument('--cfg', type=str, default='models/yolov7.yaml', help='model.yaml path') parser.add_argument('--data', type=str, default='data/yolov5obb_demo.yaml', help='dataset.yaml path') parser.add_argument('--hyp', type=str, default='data/hyps/obb/hyp.scratch-low-obb.yaml', help='hyperparameters path') parser.add_argument('--epochs', type=int, default=300) parser.add_argument('--batch-size', type=int, default=24, help='total batch size for all GPUs, -1 for autobatch') parser.add_argument('--imgsz', '--img', '--img-size', type=int, default=640, help='train, val image size (pixels)') parser.add_argument('--rect', action='store_true', help='rectangular training') parser.add_argument('--resume', nargs='?', const=True, default=True, help='resume most recent training') parser.add_argument('--nosave', action='store_true', help='only save final checkpoint') parser.add_argument('--noval', action='store_true', help='only validate final epoch') parser.add_argument('--noautoanchor', action='store_true', help='disable autoanchor check') parser.add_argument('--evolve', type=int, nargs='?', const=300, help='evolve hyperparameters for x generations') parser.add_argument('--bucket', type=str, default='', help='gsutil bucket') parser.add_argument('--cache', type=str, nargs='?', const='ram', help='--cache images in "ram" (default) or "disk"') parser.add_argument('--image-weights', action='store_true', help='use weighted image selection for training') parser.add_argument('--device', default='0', help='cuda device, i.e. 0 or 0,1,2,3 or cpu') parser.add_argument('--multi-scale', action='store_true', help='vary img-size +/- 50%%') parser.add_argument('--single-cls', action='store_true', help='train multi-class data as single-class') parser.add_argument('--adam', action='store_true', help='use torch.optim.Adam() optimizer') parser.add_argument('--sync-bn', action='store_true', help='use SyncBatchNorm, only available in DDP mode') parser.add_argument('--workers', type=int, default=8, help='max dataloader workers (per RANK in DDP mode)') 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') parser.add_argument('--quad', action='store_true', help='quad dataloader') parser.add_argument('--linear-lr', action='store_true', help='linear LR') 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') 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

error message:

train_ota: weights=, cfg=models/yolov7.yaml, data=data/yolov5obb_demo.yaml, hyp=data/hyps/obb/hyp.scratch-low-obb.yaml, epochs=300, batch_size=24, imgsz=640, rect=False, resume=True, nosave=False, noval=False, noautoanchor=False, evolve=None, bucket=, cache=None, image_weights=False, device=0, multi_scale=False, single_cls=False, adam=False, sync_bn=False, workers=8, project=runs/train, name=exp, exist_ok=False, quad=False, linear_lr=False, label_smoothing=0.0, patience=100, freeze=[0], save_period=-1, local_rank=-1, entity=None, upload_dataset=False, bbox_interval=-1, artifact_alias=latest

github: skipping check (not a git repository), for updates see https://github.com/ultralytics/yolov5 Resuming training from ./runs/train/yolov7s2/weights/last.pt YOLOv5 🚀 2023-11-13 torch 1.10.1 CUDA:0 (NVIDIA GeForce RTX 3090, 24257MiB)

hyperparameters: lr0=0.01, lrf=0.18, momentum=0.937, weight_decay=0.0005, warmup_epochs=3.0, warmup_momentum=0.8, warmup_bias_lr=0.1, box=0.05, cls=0.3, cls_pw=1.0, theta=1.0, theta_pw=1.0, obj=0.7, obj_pw=1.0, iou_t=0.2, anchor_t=4.0, fl_gamma=0.0, hsv_h=0.015, hsv_s=0.7, hsv_v=0.4, degrees=0.0, translate=0.2, scale=0.5, shear=0.0, perspective=0.0, flipud=0.0, fliplr=0.5, mosaic=1.0, mixup=0.0, copy_paste=0.0, paste_in=0.0, num_theta=180, csl_radius=2.0, cls_theta=180 Weights & Biases: run 'pip install wandb' to automatically track and visualize YOLOv5 🚀 runs (RECOMMENDED) TensorBoard: Start with 'tensorboard --logdir runs/train', view at http://localhost:6006/ 2023-11-23 15:30:46.683541: I tensorflow/core/util/port.cc:113] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable TF_ENABLE_ONEDNN_OPTS=0. 2023-11-23 15:30:46.685704: I external/local_tsl/tsl/cuda/cudart_stub.cc:31] Could not find cuda drivers on your machine, GPU will not be used. 2023-11-23 15:30:46.715756: E external/local_xla/xla/stream_executor/cuda/cuda_dnn.cc:9261] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered 2023-11-23 15:30:46.715788: E external/local_xla/xla/stream_executor/cuda/cuda_fft.cc:607] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered 2023-11-23 15:30:46.716688: E external/local_xla/xla/stream_executor/cuda/cuda_blas.cc:1515] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered 2023-11-23 15:30:46.721630: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations. To enable the following instructions: AVX2 AVX512F AVX512_VNNI FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags. 2023-11-23 15:30:47.341720: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT

             from  n    params  module                                  arguments                     

0 -1 1 464 models.common.Conv [3, 16, 3, 1]
1 -1 1 4672 models.common.Conv [16, 32, 3, 2]
2 -1 1 9280 models.common.Conv [32, 32, 3, 1]
3 -1 1 18560 models.common.Conv [32, 64, 3, 2]
4 -1 1 2112 models.common.Conv [64, 32, 1, 1]
5 -2 1 2112 models.common.Conv [64, 32, 1, 1]
6 -1 1 9280 models.common.Conv [32, 32, 3, 1]
7 -1 1 9280 models.common.Conv [32, 32, 3, 1]
8 -1 1 9280 models.common.Conv [32, 32, 3, 1]
9 -1 1 9280 models.common.Conv [32, 32, 3, 1]
10 [-1, -3, -5, -6] 1 0 models.common.Concat [1]
11 -1 1 16640 models.common.Conv [128, 128, 1, 1]
12 -1 1 0 models.common.MP []
13 -1 1 8320 models.common.Conv [128, 64, 1, 1]
14 -3 1 8320 models.common.Conv [128, 64, 1, 1]
15 -1 1 36992 models.common.Conv [64, 64, 3, 2]
16 [-1, -3] 1 0 models.common.Concat [1]
17 -1 1 8320 models.common.Conv [128, 64, 1, 1]
18 -2 1 8320 models.common.Conv [128, 64, 1, 1]
19 -1 1 36992 models.common.Conv [64, 64, 3, 1]
20 -1 1 36992 models.common.Conv [64, 64, 3, 1]
21 -1 1 36992 models.common.Conv [64, 64, 3, 1]
22 -1 1 36992 models.common.Conv [64, 64, 3, 1]
23 [-1, -3, -5, -6] 1 0 models.common.Concat [1]
24 -1 1 66048 models.common.Conv [256, 256, 1, 1]
25 -1 1 0 models.common.MP []
26 -1 1 33024 models.common.Conv [256, 128, 1, 1]
27 -3 1 33024 models.common.Conv [256, 128, 1, 1]
28 -1 1 147712 models.common.Conv [128, 128, 3, 2]
29 [-1, -3] 1 0 models.common.Concat [1]
30 -1 1 33024 models.common.Conv [256, 128, 1, 1]
31 -2 1 33024 models.common.Conv [256, 128, 1, 1]
32 -1 1 147712 models.common.Conv [128, 128, 3, 1]
33 -1 1 147712 models.common.Conv [128, 128, 3, 1]
34 -1 1 147712 models.common.Conv [128, 128, 3, 1]
35 -1 1 147712 models.common.Conv [128, 128, 3, 1]
36 [-1, -3, -5, -6] 1 0 models.common.Concat [1]
37 -1 1 263168 models.common.Conv [512, 512, 1, 1]
38 -1 1 0 models.common.MP []
39 -1 1 131584 models.common.Conv [512, 256, 1, 1]
40 -3 1 131584 models.common.Conv [512, 256, 1, 1]
41 -1 1 590336 models.common.Conv [256, 256, 3, 2]
42 [-1, -3] 1 0 models.common.Concat [1]
43 -1 1 65792 models.common.Conv [512, 128, 1, 1]
44 -2 1 65792 models.common.Conv [512, 128, 1, 1]
45 -1 1 147712 models.common.Conv [128, 128, 3, 1]
46 -1 1 147712 models.common.Conv [128, 128, 3, 1]
47 -1 1 147712 models.common.Conv [128, 128, 3, 1]
48 -1 1 147712 models.common.Conv [128, 128, 3, 1]
49 [-1, -3, -5, -6] 1 0 models.common.Concat [1]
50 -1 1 263168 models.common.Conv [512, 512, 1, 1]
51 -1 1 1904128 models.common.SPPCSPC [512, 256, 1]
52 -1 1 33024 models.common.Conv [256, 128, 1, 1]
53 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest']
54 37 1 65792 models.common.Conv [512, 128, 1, 1]
55 [-1, -2] 1 0 models.common.Concat [1]
56 -1 1 33024 models.common.Conv [256, 128, 1, 1]
57 -2 1 33024 models.common.Conv [256, 128, 1, 1]
58 -1 1 73856 models.common.Conv [128, 64, 3, 1]
59 -1 1 36992 models.common.Conv [64, 64, 3, 1]
60 -1 1 36992 models.common.Conv [64, 64, 3, 1]
61 -1 1 36992 models.common.Conv [64, 64, 3, 1]
62[-1, -2, -3, -4, -5, -6] 1 0 models.common.Concat [1]
63 -1 1 65792 models.common.Conv [512, 128, 1, 1]
64 -1 1 8320 models.common.Conv [128, 64, 1, 1]
65 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest']
66 24 1 16512 models.common.Conv [256, 64, 1, 1]
67 [-1, -2] 1 0 models.common.Concat [1]
68 -1 1 8320 models.common.Conv [128, 64, 1, 1]
69 -2 1 8320 models.common.Conv [128, 64, 1, 1]
70 -1 1 18496 models.common.Conv [64, 32, 3, 1]
71 -1 1 9280 models.common.Conv [32, 32, 3, 1]
72 -1 1 9280 models.common.Conv [32, 32, 3, 1]
73 -1 1 9280 models.common.Conv [32, 32, 3, 1]
74[-1, -2, -3, -4, -5, -6] 1 0 models.common.Concat [1]
75 -1 1 16512 models.common.Conv [256, 64, 1, 1]
76 -1 1 0 models.common.MP []
77 -1 1 4224 models.common.Conv [64, 64, 1, 1]
78 -3 1 4224 models.common.Conv [64, 64, 1, 1]
79 -1 1 36992 models.common.Conv [64, 64, 3, 2]
80 [-1, -3, 63] 1 0 models.common.Concat [1]
81 -1 1 33024 models.common.Conv [256, 128, 1, 1]
82 -2 1 33024 models.common.Conv [256, 128, 1, 1]
83 -1 1 73856 models.common.Conv [128, 64, 3, 1]
84 -1 1 36992 models.common.Conv [64, 64, 3, 1]
85 -1 1 36992 models.common.Conv [64, 64, 3, 1]
86 -1 1 36992 models.common.Conv [64, 64, 3, 1]
87[-1, -2, -3, -4, -5, -6] 1 0 models.common.Concat [1]
88 -1 1 65792 models.common.Conv [512, 128, 1, 1]
89 -1 1 0 models.common.MP []
90 -1 1 16640 models.common.Conv [128, 128, 1, 1]
91 -3 1 16640 models.common.Conv [128, 128, 1, 1]
92 -1 1 147712 models.common.Conv [128, 128, 3, 2]
93 [-1, -3, 51] 1 0 models.common.Concat [1]
94 -1 1 131584 models.common.Conv [512, 256, 1, 1]
95 -2 1 131584 models.common.Conv [512, 256, 1, 1]
96 -1 1 295168 models.common.Conv [256, 128, 3, 1]
97 -1 1 147712 models.common.Conv [128, 128, 3, 1]
98 -1 1 147712 models.common.Conv [128, 128, 3, 1]
99 -1 1 147712 models.common.Conv [128, 128, 3, 1]
100[-1, -2, -3, -4, -5, -6] 1 0 models.common.Concat [1]
101 -1 1 262656 models.common.Conv [1024, 256, 1, 1]
102 75 1 82432 models.common.RepConv [64, 128, 3, 1]
103 88 1 328704 models.common.RepConv [128, 256, 3, 1]
104 101 1 1312768 models.common.RepConv [256, 512, 3, 1]
105 [102, 103, 104] 1 504212 models.yolo.IDetect [1, [[12, 16, 19, 36, 40, 28], [36, 75, 76, 55, 72, 146], [142, 110, 192, 243, 459, 401]], [128, 256, 512]] /home/root1/anaconda3/envs/yolov7obb/lib/python3.9/site-packages/torch/functional.py:445: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at /opt/conda/conda-bld/pytorch_1639180487213/work/aten/src/ATen/native/TensorShape.cpp:2157.) return _VF.meshgrid(tensors, **kwargs) # type: ignore[attr-defined] Model Summary: 415 layers, 9807460 parameters, 9807460 gradients, 28.2 GFLOPs

Transferred 566/566 items from runs/train/yolov7s2/weights/last.pt Scaled weight_decay = 0.000375 Traceback (most recent call last): File "/home/root1/test/yolov7_obb/YOLOv7_CLS_DOTA/YOLOv7_obb-master/train_ota.py", line 696, in main(opt) File "/home/root1/test/yolov7_obb/YOLOv7_CLS_DOTA/YOLOv7_obb-master/train_ota.py", line 593, in main train(opt.hyp, opt, device, callbacks) File "/home/root1/test/yolov7_obb/YOLOv7_CLS_DOTA/YOLOv7_obb-master/train_ota.py", line 216, in train if opt.adam: AttributeError: 'Namespace' object has no attribute 'adam'

SSTato commented 11 months ago

parser.add_argument('--resume', nargs='?', const=True, default=False, help='resume most recent training')