A question about inserting the module into yolov5
iangiu opened this issue · 3 comments
Hi, I have read the impressive paper, and i try to insert the module into some tasks of object detection. Concretely, i modified the dataset module and the calculation loss module in yolov5. As following:
from utils.infobatch import InfoBatch
info_dataset = InfoBatch(dataset, 0.5, 100, 0.875)
dataloader = loader(info_dataset,
batch_size=batch_size,
num_workers=nw,
sampler=info_dataset.pruning_sampler(),
pin_memory=True,
)
info_dataset.__setscore__(indice.detach().cpu().numpy().astype(int), loss.detach().cpu().numpy())
During the training process, I encountered a severe loss of mAP metric under the same epoch setting and default hyperparameter conditions. By the way, I pruned at the image level, not the target level. I do not know how to optimize or improve, I hope the author can give me some advice. Thanks a lot.
Before the update of yolo example, one thing to check is the hyperparameter order, which should be "args.num_epoch, args.ratio, args.delta" in provided code. If you have already modified it, then another thing to check is how sample indices are mapped with scores. Do you have multiple objects for one image? If so, we can average their detached loss to calculate the score for the given image.
@iangiu Hi, I have adapted the loss and training run for ultralytics YOLO. See https://github.com/henryqin1997/ultralytics-infobatch . Do you have hyperparameters so that I can test whether it reproduces lossless results with reported savings? I will update the document this weekend to show how I adapt it. Right now one can find it in study_case.ipynb and commit records. By the way, the bbox losses should be summed to a score for one sample, as it was counted for normal training.
@henryqin1997 Hi,hyp of yolov5 as following:
lr0: 0.01
lrf: 0.1
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.5
cls_pw: 1.0
obj: 1.0
obj_pw: 1.0
iou_t: 0.2
anchor_t: 4.0
fl_gamma: 0.0
hsv_h: 0.015
hsv_s: 0.0
hsv_v: 0.1
degrees: 0.0
translate: 0.1
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
hyp of infobatch as following:
ratio=0.5
delta=0.875