-
Notifications
You must be signed in to change notification settings - Fork 982
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
Image translation with SPADE? #112
Comments
HA, I also face the same question.If label_nc 0,it would be: IndexError: index 0 is out of bounds for dimension 0 with size 0 |
I was interested in this since I heard about SPADE. Now I had some time with code and can say something interesting.
|
So I took this approach trying to get https://github.com/tamarott/ASAPNet working with rgb to rgb translation. It works, but is painfully slow. My training tests happen on a lowly 3060, which on a 512x512 image set took 1.35m/100iter using 10gb of vram, also known as "forever" in scability terms. These are the following optimizations that worked for me to successfully train on limited dataset size: Arguments No changes from above recommendations: 1.35m/10gb If you have data throughput issues it can also be helpful to set nThreads > 0 File Changes train.py - torch.backends.cudnn.benchmark = True : 0.23m/8.8gb pix2pixmodel.py (required apex) Mixed Precision Simply following the standard Apex changes (So helpfully provided here https://github.com/bholeshwar/SPADE-with-AMP) results in 0.178m/8.9gb (or 0.214m/9gb at ndf=64) However in testing I found I had to lower my learning rate (In my case down to 0.0001) to avoid gradient overflow crashes. Update: Division by zero crashes continued to occur even with a reduced learning rate on my full training set. My solution was to set amp to O2. Slight loss in training speed, but still much improved and now totally stable for my training task at default learning rate. Conclusion So from 1.35m/100iters down to, in my case, 0.214m/100iters, making it actually feasible to test on my 3060 before deploying the full dataset to a cloud gpu. Full disclosure, I'm a Technical Artist, not a Data Scientist, so it's very possible Gob voice I've made a huge mistake, but based on the limited dataset I provided (1000 pairs), after 300 epochs the training quality was as expected. Hopes this saves someone some time/money! |
Hi @kex243, I was trying to translate RGB2RGB without instance map and seg_map. Can u gimme more information that how to train it? Like the parameter setting, such as --label_nc , which value should I set for label_nc? For my case, the data_model I use is custom right? Any helps will be appreciated! Thanks |
@Macleodsolutions Did you had any issues with artifacts (random color pixels) in your training of ASAPNet? |
@AugustLee93 |
@iamrishab When will you share your code? Appreciate it ! |
@AugustLee93 PR raised. |
Is there any way to not to use the label_img and just to make image to image translation with SPADE? Pix2pixHD has option -label_nc 0, but it is no avaliable here, cuases error. I mean paired aligned dataset. Thanks.
The text was updated successfully, but these errors were encountered: