uber-research / UPSNet

UPSNet: A Unified Panoptic Segmentation Network
Other
645 stars 120 forks source link

number of classes #114

Closed discretecoder closed 4 years ago

discretecoder commented 4 years ago

I have 50 classes in my dataset out of which 25 are thing and 25 are stuff. in the panoptic_coco_categories.json, i have marked them as isthing = 0 and 1 and i created instance labels for only things and panoptic labels for both things and stuff. during my training, if i write number of classes 25+1 = 26, it does not accept it. but if i write number of classes 51, it trains. what could be the problem?

discretecoder commented 4 years ago

File "./upsnet/../upsnet/operators/modules/proposal_mask_target.py", line 49, in forward frcn_blobs = sample_rois(entry, im_info[im_i, 2], im_i) File "./upsnet/../upsnet/bbox/sample_rois.py", line 105, in sample_rois bbox_targets, bbox_inside_weights = _expand_bbox_targets(bbox_targets) File "./upsnet/../upsnet/bbox/sample_rois.py", line 174, in _expand_bbox_targets bbox_targets[ind, start:end] = bbox_target_data[ind, 1:] ValueError: could not broadcast input array from shape (4) into shape (0)

this is the error that i get when I use 25+1 classes

choodly commented 4 years ago

I also encountered the same problem, how do you solve it?

wshilaji commented 3 years ago

I also encountered the same problem, how do you solve it?

how do you solve it?I also encountered the same problem

rlangefe commented 3 years ago

I ran into this too. Is there a solution?

wshilaji commented 3 years ago

I ran into this too. Is there a solution?

have you solved it?

rlangefe commented 3 years ago

Yeah! I solved it for us! We determined that it pulls the "thing" segmentations from the instances_xxx2017.json file. For us, the issue was that we were putting all the segmentations (things and stuff) into the instances json file. We have 1 additional class for num_classes (all the classes with isthing as true) and then one additional class for num_seg_classes (everything together). When we made the instances json file with just the thing classes, it resolved our issue. Also, make sure that your setup script re-indexes the panoptic categories file so that stuff classes are first instead of mixed.

wshilaji commented 3 years ago

Yeah! I solved it for us! We determined that it pulls the "thing" segmentations from the instances_xxx2017.json file. For us, the issue was that we were putting all the segmentations (things and stuff) into the instances json file. We have 1 additional class for num_classes (all the classes with isthing as true) and then one additional class for num_seg_classes (everything together). When we made the instances json file with just the thing classes, it resolved our issue. Also, make sure that your setup script re-indexes the panoptic categories file so that stuff classes are first instead of mixed.

Yeah! I solved it for us! We determined that it pulls the "thing" segmentations from the instances_xxx2017.json file. For us, the issue was that we were putting all the segmentations (things and stuff) into the instances json file. We have 1 additional class for num_classes (all the classes with isthing as true) and then one additional class for num_seg_classes (everything together). When we made the instances json file with just the thing classes, it resolved our issue. Also, make sure that your setup script re-indexes the panoptic categories file so that stuff classes are first instead of mixed.

Thank you.In fact, I solved this problem the day before yesterday. I changed init_coco.py about my own category number

 idx_mapping = {**{idx1: idx2 for idx1, idx2 in zip(range(8), range(7, 15))}, **{idx1: idx2 for idx1, idx2 in zip(range(8, 15), range(7))}}
    inv_idx_mapping = {**{idx1: idx2 for idx1, idx2 in zip(range(7), range(8, 15))}, **{idx1: idx2 for idx1, idx2 in zip(range(7, 15), range(8))}}

I made a mistake later because coco2014 instance2014 have background class,and instance2017 don't have background class.I refer to the wrong format when I write scripts

Now ,everything is OK,,Thank you

rlangefe commented 3 years ago

Can you clarify that a little more? I thought I new the mapping, but I don't think I really do. So, when I looked at this code, I thought it was just moving the "stuff" classes to the beginning. I flipped it and created that mapping and then started the new mapping at id 0, even though my initial ids started at 1. When I ran the test script, it could not find the color for class 14 (we have 14 total classes) when I try to generate the panoptic visualizations. Have you seen anything like this?

wshilaji commented 3 years ago

Can you send your error or warnning tips? Do you use wechat , qq,or twitter?GitHub is too inconvenient to use. Is there no category ['color '] in your dataset format?

rlangefe commented 3 years ago

You can email me about it at my university email langrc18 'at' wfu.edu.

rlangefe commented 3 years ago

Sorry, but could you say more about how you made the category mapping or email me about it? I'm still a little confused on it.

wshilaji commented 3 years ago

my format is coco. If your own instance category is 5 and your stuff category is 8,now you should change /upsnet/experiment/ resnent_4gpu_coco.yaml the nums_classes is 6 (instance category +1) and nums_seg_classes 13 (instance category +stuff category). Last you should change code in init_coco.py refer to your own category ` idx_mapping = {{idx1: idx2 for idx1, idx2 in zip(range(x), range(x, x))}, {idx1: idx2 for idx1, idx2 in zip(range(x, 13), range(x))}} inv_idx_mapping = {{idx1: idx2 for idx1, idx2 in zip(range(x, range(x, 13))}, **{idx1: idx2 for idx1, idx2 in zip(range(x, 13), range(8))}} ` it will be OK