Skip to content

Commit

Permalink
Merge pull request #4 from aash1999/cbam-imp
Browse files Browse the repository at this point in the history
adding hyp and model files as mentioned in paper
  • Loading branch information
aash1999 authored Oct 24, 2023
2 parents 79112df + 3d46323 commit f0b2ffc
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 0 deletions.
34 changes: 34 additions & 0 deletions data/hyps/cbam.hyp.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# YOLOv5 🚀 by Ultralytics, AGPL-3.0 license
# Hyperparameters for low-augmentation COCO training from scratch
# python train.py --batch 64 --cfg yolov5n6.yaml --weights '' --data coco.yaml --img 640 --epochs 300 --linear
# See tutorials for hyperparameter evolution https://github.com/ultralytics/yolov5#tutorials

lr0: 0.001 # initial learning rate (SGD=1E-2, Adam=1E-3)
lrf: 0.01 # final OneCycleLR learning rate (lr0 * lrf)
momentum: 0.937 # SGD momentum/Adam beta1
weight_decay: 0.0005 # optimizer weight decay 5e-4
warmup_epochs: 3.0 # warmup epochs (fractions ok)
warmup_momentum: 0.8 # warmup initial momentum
warmup_bias_lr: 0.1 # warmup initial bias lr
box: 0.05 # box loss gain
cls: 0.25 # cls loss gain
cls_pw: 1.0 # cls BCELoss positive_weight
obj: 0.5 # obj loss gain (scale with pixels)
obj_pw: 1.0 # obj BCELoss positive_weight
iou_t: 0.20 # IoU training threshold
anchor_t: 4.0 # anchor-multiple threshold
# anchors: 3 # anchors per output layer (0 to ignore)
fl_gamma: 0.0 # focal loss gamma (efficientDet default gamma=1.5)
hsv_h: 0.4 # image HSV-Hue augmentation (fraction)
hsv_s: 0.3 # image HSV-Saturation augmentation (fraction)
hsv_v: 0.5 # image HSV-Value augmentation (fraction)
degrees: 0.2 # image rotation (+/- deg)
translate: 0.1 # image translation (+/- fraction)
scale: 0.4 # image scale (+/- gain)
shear: 0.0 # image shear (+/- deg)
perspective: 0.0 # image perspective (+/- fraction), range 0-0.001
flipud: 0.0 # image flip up-down (probability)
fliplr: 0.5 # image flip left-right (probability)
mosaic: 1.0 # image mosaic (probability)s
mixup: 0.2 # image mixup (probability)
copy_paste: 0.1 # segment copy-paste (probability)
60 changes: 60 additions & 0 deletions models/yolov5s-cbam-involution.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# YOLOv5 🚀 by Ultralytics, GPL-3.0 license

# Parameters
nc: 10 # number of classes
depth_multiple: 0.33 # model depth multiple
width_multiple: 0.50 # layer channel multiple
anchors:
- [2.9434,4.0435, 3.8626,8.5592, 6.8534, 5.9391]
- [10,13, 16,30, 33,23] # P3/8
- [30,61, 62,45, 59,119] # P4/16
- [116,90, 156,198, 373,326] # P5/32

# YOLOv5 v6.0 backbone
backbone:
# [from, number, module, args]
[[-1, 1, Conv, [64, 6, 2, 2]], # 0-P1/2
[-1, 1, Conv, [128, 3, 2]], # 1-P2/4
[-1, 3, C3, [128]],
[-1, 1, Conv, [256, 3, 2]], # 3-P3/8
[-1, 6, C3, [256]],
[-1, 1, Conv, [512, 3, 2]], # 5-P4/16
[-1, 9, C3, [512]],
[-1, 1, Conv, [1024, 3, 2]], # 7-P5/32
[-1, 3, C3, [1024]],
[-1, 3, CBAMBottleneck, [1024, 3]],
[-1, 1, SPPF, [1024, 5]], # 10
]

# YOLOv5 v6.0 head
head:
[[-1, 1, Involution, [1024, 1, 1]],
[-1, 1, Conv, [512, 1, 1]],
[-1, 1, nn.Upsample, [None, 2, 'nearest']],
[[-1, 6], 1, Concat, [1]], # cat backbone P4
[-1, 3, C3, [512, False]], # 15

[-1, 1, Conv, [512, 1, 1]],
[-1, 1, nn.Upsample, [None, 2, 'nearest']],
[[-1, 4], 1, Concat, [1]], # cat backbone P3
[-1, 3, C3, [512, False]], # 19

[-1, 1, Conv, [256, 1, 1]],
[-1, 1, nn.Upsample, [None, 2, 'nearest']],
[[-1, 2], 1, Concat, [1]],
[-1, 3, C3, [256, False]], # 23 160*160 p2 head

[-1, 1, Conv, [256, 3, 2]],
[[-1, 19], 1, Concat, [1]],
[-1, 3, C3, [512, False]], # 26 80*80 p3 head

[-1, 1, Conv, [256, 3, 2]],
[[-1, 15], 1, Concat, [1]],
[-1, 3, C3, [256, False]], # 29 40*40 p4 head

[-1, 1, Conv, [512, 3, 2]],
[[-1, 11], 1, Concat, [1]],
[-1, 3, C3, [1024, False]], # 32 20*20 p5 head

[[23, 26, 29, 32], 1, Detect, [nc, anchors]], # Detect(P2, P3, P4, P5)
]

0 comments on commit f0b2ffc

Please sign in to comment.