GHM_Detection icon indicating copy to clipboard operation
GHM_Detection copied to clipboard

how to train only one classes

Open fengxiuyaun opened this issue 6 years ago • 4 comments

hi, I want to train only one class, I edit num_classes=2, bug I get this error RuntimeError: Expected object of type torch.cuda.FloatTensor but found type torch.cuda.LongTensor for argument #3 'other'

fengxiuyaun avatar Jan 24 '19 07:01 fengxiuyaun

@fengxiuyaun could you provide more details? Such as the location where the error appear, and whether you write a new data_loader (since the default coco data set code do not support num_classes=2) .

libuyu avatar Jan 24 '19 09:01 libuyu

hi, because this,
if cls_out_channels > 1: labels, label_weights = expand_binary_labels(labels, label_weights, cls_out_channels) labels is not translation to float....

fengxiuyaun avatar Jan 24 '19 11:01 fengxiuyaun

https://github.com/libuyu/GHM_Detection/blob/0b3917d95870382b1e01c9917e042a93436c5e32/mmdetection/mmdet/core/anchor/anchor_target.py#L146

fengxiuyaun avatar Jan 24 '19 11:01 fengxiuyaun

Well done! So if you use binary classification (one class det), just modify this line.

It seems that mmdetection hasn't consider one class output channel now. I will talk with the contributors about this issue.

Thank you very much.

libuyu avatar Jan 24 '19 11:01 libuyu