Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Training with custom data #70

Closed
Amit12690 opened this issue Jun 19, 2019 · 26 comments
Closed

Training with custom data #70

Amit12690 opened this issue Jun 19, 2019 · 26 comments

Comments

@Amit12690
Copy link

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 :

  • Any annotation tool for labelling and getting the annotations in coco format

  • How to proceed once I have the annotated data ?

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

@dbolya
Copy link
Owner

dbolya commented Jun 19, 2019

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
Copy link
Author

Thanks a lot @dbolya . I will try labelme.

@abhigoku10
Copy link

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

@Amit12690
Copy link
Author

@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
Copy link
Author

Amit12690 commented Jun 21, 2019

@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
Copy link

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

@dbolya
Copy link
Owner

dbolya commented Jun 25, 2019

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.

@dbolya dbolya closed this as completed Jun 25, 2019
@imvisibleman
Copy link

hi, @Amit12690 Can you train the source code?

@imvisibleman
Copy link

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

@abhigoku10
Copy link

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

@imvisibleman
Copy link

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
Copy link

@abhigoku10 Can you help me?

@imvisibleman
Copy link

Is the Train.py code running directly?

@imvisibleman
Copy link

I don't know how to set the parameters.

@abhigoku10
Copy link

@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
Copy link

@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
Copy link

niliuxi commented Oct 21, 2019

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

@qingqinghu1026
Copy link

@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
Copy link

Zhang-O commented Jan 16, 2020

@Amit12690 why are you so intelligence!

1 similar comment
@Zhang-O
Copy link

Zhang-O commented Jan 16, 2020

@Amit12690 why are you so intelligence!

@Zhang-O
Copy link

Zhang-O commented Feb 9, 2020

@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
Copy link

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
Copy link

ApoorvaOjha commented Dec 15, 2020

@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
Copy link

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

@Mayuresh999
Copy link

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
Copy link

aravindsairam commented Mar 13, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests