dbolya / yolact

A simple, fully convolutional model for real-time instance segmentation.
MIT License
5k stars 1.32k forks source link

Training with custom data #70

Closed Amit12690 closed 5 years ago

Amit12690 commented 5 years ago

I have few images where I have to segment 2 kinds of flowers . I wish to achieve it using Yoloact. However I am very confused with how to prepare my dataset suitable for training . Can anyone please help me with the following :

Sorry if this is a very basic question . I have just started looking in to instance segmentation , so confused

dbolya commented 5 years ago

I'm not very familiar with preparing instance segmentation data as I've just been using COCO this whole time, but I've heard good things about LabelMe. Once you have the LabelMe annotations then you can use labelme2coco to convert it to coco annotations and then proceed with the custom dataset instructions in my readme.

I haven't use either of those tools though--I've just heard about others using them.

Amit12690 commented 5 years ago

Thanks a lot @dbolya . I will try labelme.

abhigoku10 commented 5 years ago

@Amit12690 as dbolya suggested , you can use that it will work since i have used the same approach for annotation and training

Amit12690 commented 5 years ago

@abhigoku10 @dbolya Thanks for the advice. Labelme is so easy to use. I am trying it on a sample dataset. Will update once I get training to work

Amit12690 commented 5 years ago

@dbolya @abhigoku10 I think my training has made progress , thanks a lot for your valuable suggestions. Labelme and labelme2coco.py work perfectly to create the dataset. For anyone who is planning to finetune/train the model on a custom dataset , please follow following steps :

Done! The dataset is created. Now proceed with the instruction in the yolact repo on custom training

abhigoku10 commented 5 years ago

@Amit12690 nice work in sharing the steps .!!!

dbolya commented 5 years ago

Thanks @Amit12690 for the steps! I've added a link to your post in the readme for future reference, and I'll close the issue for now.

imvisibleman commented 5 years ago

hi, @Amit12690 Can you train the source code?

imvisibleman commented 5 years ago

I have encountered some problems and hope to get your help.

abhigoku10 commented 5 years ago

@imvisibleman what is the problem ur facing pls share the errors

imvisibleman commented 5 years ago

I am a high school student, so my code understanding ability is not very strong, but I am very interested in yolact. Just like yoloV3, after I finished the data annotation, I don't know how to train my data.

imvisibleman commented 5 years ago

@abhigoku10 Can you help me?

imvisibleman commented 5 years ago

Is the Train.py code running directly?

imvisibleman commented 5 years ago

I don't know how to set the parameters.

abhigoku10 commented 5 years ago

@imvisibleman suggest you to look into the readme file where he has mentioned how data should be provided and even @Amit12690 has laid down the step beautifully

May-forever commented 5 years ago

@Amit12690 Hi, I want to use Yolact to train my custom dataset, unfortunately, I meet an error that I cannot solve, could you please send your email address to me? I want to show you more details with screen shot. Looking forward to hearing from you. thank you very much in advance~

niliuxi commented 4 years ago

I have got the json file now, what do I need to modify to train my data?Looking forward to your reply

qingqinghu1026 commented 4 years ago

@Amit12690 I annotated my dataset with lamebe, which is to generate a JSON file for each picture, but in the code, "train_images": "path_to train_images", "train_info": "path_to train_annotation", which should be a JSON file generated by all pictures. Please ask how to do this?

Zhang-O commented 4 years ago

@Amit12690 why are you so intelligence!

Zhang-O commented 4 years ago

@Amit12690 why are you so intelligence!

Zhang-O commented 4 years ago

@dbolya @abhigoku10 I think my training has made progress , thanks a lot for your valuable suggestions. Labelme and labelme2coco.py work perfectly to create the dataset. For anyone who is planning to finetune/train the model on a custom dataset , please follow following steps :

Done! The dataset is created. Now proceed with the instruction in the yolact repo on custom training

I am confused with how I should annotate more than one objects of same class in an img?For instance with cat, should it be cat_1, cat_2, cat_3and so on , or cat_0, cat_1, cat_2, and so on , or just cat, cat, cat,cat ,and so on? I choose the last method mentioned above, and the result is bad in my own dataset which the model predict all img with only one instance, but img contains more than one instance indeed.

goldwater668 commented 4 years ago

How to label a single category with labelme? After looking at the user-defined data set, there is no annotation naming method. For example, there is only one category in a graph: cat, cat, cat or CAT1, cat2, Cat3 or cat-0, cat-1, cat

ApoorvaOjha commented 3 years ago

@dbolya @abhigoku10 I think my training has made progress , thanks a lot for your valuable suggestions. Labelme and labelme2coco.py work perfectly to create the dataset. For anyone who is planning to finetune/train the model on a custom dataset , please follow following steps :

Done! The dataset is created. Now proceed with the instruction in the yolact repo on custom training

Hey, I am not able to convert labeltococo as it needs pycocotools, whose installation is giving building error. i have installed cython also. Please help.

ynma-hanvo commented 3 years ago

hi, guys, what will be the min number of custom images needed , to retrain a resnet101 for instance segmentation of 10 classes?

Mayuresh999 commented 1 year ago

II got this error while training on a custom dataset... I've already done changing necessary things in config.py what is the solution for this?

/content/yolact loading annotations into memory... Done (t=0.01s) creating index... index created! loading annotations into memory... Done (t=0.00s) creating index... index created! Initializing weights... Begin training!

Traceback (most recent call last): File "./train.py", line 504, in train() File "./train.py", line 270, in train for datum in data_loader: File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/dataloader.py", line 345, in next data = self._next_data() File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/dataloader.py", line 856, in _next_data return self._process_data(data) File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/dataloader.py", line 881, in _process_data data.reraise() File "/usr/local/lib/python3.7/dist-packages/torch/_utils.py", line 394, in reraise raise self.exc_type(msg) IndexError: Caught IndexError in DataLoader worker process 0. Original Traceback (most recent call last): File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/_utils/worker.py", line 178, in _worker_loop data = fetcher.fetch(index) File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/_utils/fetch.py", line 44, in data = [self.dataset[idx] for idx in possibly_batched_index] File "/content/yolact/data/coco.py", line 94, in getitem im, gt, masks, h, w, num_crowds = self.pull_item(index) File "/content/yolact/data/coco.py", line 148, in pull_item masks = [self.coco.annToMask(obj).reshape(-1) for obj in target] File "/content/yolact/data/coco.py", line 148, in masks = [self.coco.annToMask(obj).reshape(-1) for obj in target] File "/usr/local/lib/python3.7/dist-packages/pycocotools/coco.py", line 442, in annToMask rle = self.annToRLE(ann) File "/usr/local/lib/python3.7/dist-packages/pycocotools/coco.py", line 427, in annToRLE rles = maskUtils.frPyObjects(segm, h, w) File "pycocotools/_mask.pyx", line 293, in pycocotools._mask.frPyObjects IndexError: list index out of range

aravindsairam commented 1 year ago

II got this error while training on a custom dataset... I've already done changing necessary things in config.py what is the solution for this?

/content/yolact loading annotations into memory... Done (t=0.01s) creating index... index created! loading annotations into memory... Done (t=0.00s) creating index... index created! Initializing weights... Begin training!

Traceback (most recent call last): File "./train.py", line 504, in train() File "./train.py", line 270, in train for datum in data_loader: File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/dataloader.py", line 345, in next data = self._next_data() File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/dataloader.py", line 856, in _next_data return self._process_data(data) File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/dataloader.py", line 881, in _process_data data.reraise() File "/usr/local/lib/python3.7/dist-packages/torch/_utils.py", line 394, in reraise raise self.exc_type(msg) IndexError: Caught IndexError in DataLoader worker process 0. Original Traceback (most recent call last): File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/_utils/worker.py", line 178, in _worker_loop data = fetcher.fetch(index) File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/usr/local/lib/python3.7/dist-packages/torch/utils/data/_utils/fetch.py", line 44, in data = [self.dataset[idx] for idx in possibly_batched_index] File "/content/yolact/data/coco.py", line 94, in getitem im, gt, masks, h, w, num_crowds = self.pull_item(index) File "/content/yolact/data/coco.py", line 148, in pull_item masks = [self.coco.annToMask(obj).reshape(-1) for obj in target] File "/content/yolact/data/coco.py", line 148, in masks = [self.coco.annToMask(obj).reshape(-1) for obj in target] File "/usr/local/lib/python3.7/dist-packages/pycocotools/coco.py", line 442, in annToMask rle = self.annToRLE(ann) File "/usr/local/lib/python3.7/dist-packages/pycocotools/coco.py", line 427, in annToRLE rles = maskUtils.frPyObjects(segm, h, w) File "pycocotools/_mask.pyx", line 293, in pycocotools._mask.frPyObjects IndexError: list index out of range

This is happened because of empty segmentation list. Please make sure you do not have empty segmentation mask in your json annotation file.