-
Notifications
You must be signed in to change notification settings - Fork 11.7k
Multiple image augmentation for training dataset #768
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
Comments
Dont use
I couldnt personally get around the problem so I made sure the database was used six times, that is in practice:
Note! Whats good about this is also that the effect of augmentations is random, which creates a more safe gradient descent. Training 6 times in a row on the same image, I believe would make your training slower as the gradient descent take bigger leaps in the direction of each batch, thus zig zaging down to local minima. |
Dear Magnus (@zungam ), thank you so much for your suggestion. I'll give it a try and I'll let you know about the result when it's done. However, there are couple of things I'd like to clarify from you.
It would be nice if we can achieve this easily, for example, by feeding list of augmentation in the augmentation keyword when we call the train method. |
If really want to try this. You could go into load_img_gt and data_generator and make them repeat the same image 6 times in a row. You have to be creative to achieve this. Perhaps something like: initalize
instead of
Then you can define 6 types of augmentation in load_img_gt, and make it switch to what augmentation it uses as a function of that state it is in (0,1,2,3,4 or 5). |
Thanks @zungam, I'll give this a try. |
@ronykalfarisi I'm facing a similar issue trying to train on plant stems. Did you manage to find a solution to diagonal objects? The difference in my dataset is that all the stems are already diagonal in my training dataset, but it still can't detect them. I have a feeling that maybe it's because the detection box area is much larger than the actual object inside. |
Hi @waspinator, |
@ronykalfarisi how many cracks do you have in your dataset? less than 2000? |
Hi @fastlater , |
@ronykalfarisi Well, I have only 75 images (65 for training + 5 for val + 5 for testing). From those 65 training images, I only have 1000 and I though maybe because of that I was not getting good results. But you are proving the opposite with your little data. |
@fastlater, I believe you need more images, I tried using Faster RCNN before and it worked with 300 images. I haven't tried with less data though |
if I set STEPS_PER_EPOCH larger than my original dataset, does the script generates some extra augmented images to complete the steps? Does model takes some augmented images automatically each epoch? |
From my experience, increasing steps_per_epoch doesn't affect the performance. So, it's better to leave it at default (100 in my case). If you use augmentation option, it depends on the probability. You can modify the script how often it does the augmentation, but I think the default is 0.5 or in other words, it only augment your dataset by half |
Hey @ronykalfarisi three questions for you if you have a moment:
Thanks!! |
|
|
Hi, have you found anyways to solve your problem in how to make multiple image augmentation for training dataset? If you have found any, truly appreciate if you can share the solution. Thanks in advance. |
Hi @ronykalfarisi ! I'm working on a dataset with nearly same size as yours and dealing with thin and long masks (horizontal, vertical, and diagonal). I was wondering how you modified the configs to get a good performance. You already mentioned that mrcnn_mask_loss weight is effective. But what about other config elements (unmold_mask threshold, RPN_ANCHOR_RATIOS for example)? I would appreciate it you advise me on that. |
@soheilsadeghi90 & @xDzai94 , |
@ronykalfarisi What do you exactly mean by "I moved toward TensorFlow implementation of Mask-RCNN"? I believe I am also using the TensorFlow implementation. However, looking at the code it only has one (combination of) data augmentation(s) for each single image. I cannot increase the number of total images by using this function of data augmentation. Am I just not seeing something (e.g. missing a functionality in the TensorFlow implementation) or is the TensorFlow implementation something totally different than the standard way of using Mask-RCNN? |
@jordanvandijk9 , I'm sorry, what I meant was "TensorFlow Team" implementation. They have several implementations in their "research" folder and one of them is object detection API. |
Hi @ronykalfarisi , how can I increase it by10 ? |
Hi @Amrimn ,
replace the number as you like. |
Hi, I am researching on a similar problem. Would highly appreciate if you could provide me the link for the TensorFlow Team Implementation of Mask-RCNN which improved accuracy in your case. Thanks :) |
@rubeea , |
Hi @zungam, can you explain why have to set shuffle=False in here. |
Dear @ronykalfarisi Can I see your repo for this case? |
@1chimaruGin , sorry bro I used it for work so I can't show it. However, I used the repo from Tensorflow research team with several modifications. |
Hi, thank you for suggesting to use the tensorflow team implementation for mask rcnn. Do you confirm that this implementation is more accurate than the matteport one ? |
Anybody here , know how to augmentation mask rcnn ? |
Didn't quite understand your question. You want to do augmentation for the training data? |
Both
Both , training case and validation case |
You can use Augmentor python api for augmenting training and validation image data along with the respective masks. Link below: |
Thanks bro, but i need . Json not just masking like this |
If you want to label your own data you can use any appropriate online annotation tool such as https://labelbox.com/ which will give you all the images and respective annotations in json file. |
Hey guys. I have a question regardless data augmentation using imgaug |
Dear All and @waleedka ,


I've been using this repo to detect and create masking for crack damage on bridge structures. My training dataset has 850 images and overall I got decent result. As you can see in two images below, the model can detect and segment horizontal and vertical crack well. But it fails in detecting diagonal crack. So, I'm thinking that I could solve this problem if I have more images.
I noticed that we could use image augmentation in the training stage using the keyword option augmentation as follow
However, from what I understand, this augmentation is applied consecutively to each image. In other words, for each image, the augmentation apply flip LR, and then followed by flip UD, then followed by rotation of -45 and 45, then followed by another rotation of -90 and 90, and lastly followed by scaling with factor 0.5 and 1.5.
So, my question is, Is there a way to apply each augmentation separately for each image? What I meant by this is, I want each augmentation to generate one extra data (and mask) alongside with the original. If this can be achieved, the augmentation will generate 6x total images when I apply 5 image augmentation making the whole dataset contains 5100 images.
Thank you and I really appreciate the helps.
The text was updated successfully, but these errors were encountered: