Closed ellick53 closed 5 years ago
Strange that it throws OOM with batch size of 1. Can you try with a lower resolution and make sure that your GPU isn't being utilized by any other application? I had trained the mode on 1080ti aswell, but on 3 of them with 8 images per GPU with resolution of 512x512. Also if you are not distributing the training loop on multiple GPU's, remove the distribute strategy scope when you build the model. And here is a better repository if you are planning for binary segmentation https://github.com/srihari-humbarwadi/person_segmentation_tf2.0
Indeed, it works at 480x320 with batch_size = 4, thanks. As I'm trying to do a binary segmentation, I'm quite interested in the other repo. What changed, exactly? If I'm reading correctly, there are changes only to the learning rate and the data augmentation, right?
@ellick53 the model is the same, but that repo better data augmentation. LR is something that you may want to tune according to your dataset. Another thing that i would like to add is please try running the code from the terminal directly and not within vscode
, something like this python train.py
and let me know if it still triggers OOM.
Thanks, I'll tell you once I've done some tests. Really nice job, btw. Are you using dice loss against class imbalance?
That's only a metric, it's not included in the optimization
I'm a bit confused about the changes regarding classes: do you consider the background as the 'ignore' class or as a class by itself? And why did you change the softmax into a sigmoid?
@ellick53 Since there are only two classes background and foreground the binary segmentation model has only 1 output channel with sigmoid activation to make sure the value of each pixel in the output channel has a value between [0, 1]. You can treat this value as the probability of the pixel belonging to the foreground class. Hope this helps!
Hello,
And thanks for sharing your code! I have a dataset that contains 640x480 RGB PNG images and 640x480 masks, which have only two classes: pixel = 0 for background and pixel = 1 for the class I want to segment .There are other tiny changes like setting H=480 and W=640 in get_image().
I commented out the random crop and set this at the top:
For some reason I get OOM errors, even if I set batch_size to one:
Could you help me? Thanks!