我是初学者。我有YOLO格式的注释数据集。我想知道如何将具有相同参数的相同增强管道应用于具有相应边界框标签的图像文件夹。我有7类在一个文件夹。
我想通过增加来人为地增加所有类的数据,因为所有类现在都是不平衡的。我尝试在我的数据集上训练YOLOv5s,将其分成80%的训练,10%的验证,10%的测试,但训练精度只有<20%,没有增加。我训练了250多次。我发现的一种方法是通过增强来增加数据集。
有人能帮我解决这个问题吗?
我认为您可以通过调整此文件中的超参数来增强图像https://github.com/WongKinYiu/yolov7/blob/main/data/hyp.scratch.custom.yaml
lr0: 0.01 # initial learning rate (SGD=1E-2, Adam=1E-3)
lrf: 0.1 # 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.3 # cls loss gain
cls_pw: 1.0 # cls BCELoss positive_weight
obj: 0.7 # 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.015 # image HSV-Hue augmentation (fraction)
hsv_s: 0.7 # image HSV-Saturation augmentation (fraction)
hsv_v: 0.4 # image HSV-Value augmentation (fraction)
degrees: 0.0 # image rotation (+/- deg)
translate: 0.2 # image translation (+/- fraction)
scale: 0.5 # 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)
mixup: 0.0 # image mixup (probability)
copy_paste: 0.0 # image copy paste (probability)
paste_in: 0.0 # image copy paste (probability), use 0 for faster training
loss_ota: 1 # use ComputeLossOTA, use 0 for faster training
编辑:您可以在将图像放入模型之前先使用Albumentations库来增强图像。https://albumentations.ai/docs/examples/
Albumentations也会照顾你的边界框。