I wanna train maskrcnn in a custom data. While, I found need generate json format files and change folder of dataset code. Have any official suggestions to train own data. How to generate own json annotation and modify lib code?
mantap
I have tried my custom json data as per coco api generated, unfortunately, found the segmentation field is too hard to handle. Then went through the detectron code, saw the process of RLE format of segmentation is hard-coded, will be invalid in detectron for my custom. But my custom data can run on MatterPort' implementation to MaskRCNN.
Another, how to absolutely disable horizontal flip? I found it may cause my custom data be not used.
I tried to set config field "USE_FLIPPED" as "False" in .yaml file, but not valid.
I also successfully implement my data in mxnet version of maskrcnn. Yesterday, I try out using coco-api to generate custom json, but not succeed. While, I checked the code in dataset folder, I think need modify some lines, but not just change config.
@xuhuaren , Where code do you modify before run successfully?
@topcomma for caffe2 version of maskrcnn, I'm not succeed. For mxnet, just change config.file, dataset.py and generate dataset following Cityscapes data format. Enjoy it. By the way, what about the performance of keras version maskrcnn in COCO?
@xuhuaren ,I did not try on Keras for it.
MaskRCNN can run on MXNet? from GitHub code or you implemented?
I think this one: https://github.com/juanluislm/MaskRCNN
Anyone try to run with Tensorflow version https://github.com/matterport/Mask_RCNN . It looks good but the performance did not report yet
I got this to work on my own data, but I just made the segmentation field the exact same as the bbox. It seems like the field is a list of x y coordinates that creates some sort of closed shape. I just created a box with four corners and then ended it with the first point to close the box (but not sure if closing the shape is needed).
@dhpollack : Does it work? I can make the bounding boxes from these masks, but I do not know how to prepare data for training with the Detectron. Could you share something to do it?
I created masks from bounding boxes and not the other way around. Since the annotations that I had only had bounding boxes but no segmentations. Obviously this won't correctly segment the image, but I am just looking for bounding boxes and crudely testing to see if I can get the network to train on something.
# xmlbox is the bndbox object in the xml
bndbox = (float(xmlbox.find('xmin').text), float(xmlbox.find('xmax').text), float(xmlbox.find('ymin').text), float(xmlbox.find('ymax').text))
# convert to (x, y, w, h)
bbox = (bndbox[0], bndbox[2], bndbox[1] - bndbox[0], bndbox[3] - bndbox[2])
segm = [[bndbox[0], bndbox[2], bndbox[0], bndbox[3], bndbox[1], bndbox[3], bndbox[1], bndbox[2], bndbox[0], bndbox[2]]]
I see. I have an invert problem that you have. I only have segmented image, then I create bounding box from it. However, the problem is that we have to convert it to coco format before we can run the Detecton as README said. I am looking the solution for that
ok, yea, I did that by creating a python dict in the same format the coco json in the repo and then saving that with the json module. The tricky part was just getting all the id fields to be named correctly and correspond to each other. I did a lot of that naively with enumeration.
There is a python script that can translate original PASCAL VOC xml to json format: https://github.com/CivilNet/Gemfield/blob/master/src/python/pascal_voc_xml2json/pascal_voc_xml2json.py
And, there also has a related blog for Chinese readers: https://zhuanlan.zhihu.com/p/34036460
@gemfield : How do you encode segmentation to the json file? I did not see it in your code.
@John1231983 : please check function addAnnoItem.
@gemfield Hi, your code is to generate polygen segmentation annotation where iscrowd=0 ,
any solution for RLE annotation (iscrowd=1)?
@JackieZhangdx Unfortunately no.
Can someone post an useful answer here
I wrote a library and article to help with creating COCO style datasets.
@waspinator Thanks, I will check it..
Most helpful comment
I created masks from bounding boxes and not the other way around. Since the annotations that I had only had bounding boxes but no segmentations. Obviously this won't correctly segment the image, but I am just looking for bounding boxes and crudely testing to see if I can get the network to train on something.