Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ESRGAN training instructions for Windows v0.0000000000000001
- Note: ESRGAN training appears to be slower on Windows than Linux by around 5x, at least on my machine.
- If you haen't gotten ESRGAN set up for testing, please read this. Everything needed to test ESRGAN is also
- needed to train it. https://kingdomakrillic.tumblr.com/post/178254875891/i-figured-out-how-to-get-esrgan-and-
- sftgan
- If you've already done all that, go to Step 1.
- 1. Download BasicSR and the ESRGAN pretrained models.
- https://github.com/xinntao/BasicSR
- https://github.com/xinntao/BasicSR#pretrained-models
- Place the models in (BasicSR directory)/experiments/pretrained_models
- 2. Download a dataset. The BasicSR creator uploaded several datasets to use here.
- https://github.com/xinntao/BasicSR#datasets
- 2a. Make absolutely sure that none of the images are greyscale or indexed colores. RGB only. You can use
- InfranView or BIMP (see below) to convert the images to RGB.
- 3. You will need to split your "training" and "validation" images. Take about 5-10% of your images and put them
- in a separate folder; these will be your validation images.
- 4. You will need to convert your dataset into fixed tiles. Open to codes/scripts/extract_subimgs_single.py.
- Change crop_sz to 192 or 128, input_folder to the full path name of your image folder, and save_folder to where
- you want to save the tiles to. If you're using Windows, replace all the slashes "\" with double slashes.
- Example:
- input_folder = 'C:\\Users\\Username\\BasicSR-master\\General100'
- save_folder = 'C:\\Users\\Username\\BasicSR-master\\General100_tiles'
- Repeat this process for the validation images.
- 5. You will need to batch convert these larger images to 4x downscaled versions. Download and open InfranView,
- press B to open the batch convert dialog, check "Use advanced options" and then click "Advanced" button to
- access the resize settings. You may want to check "Change Color Depth" if you're specifically training it for
- images with few colors. Make sure that both the LR and HR images have the same format and filename.
- If you have GIMP installed, you can also download a batch manipulation plugin called BIMP and process the image
- that way
- 6. Go to codes/options/train/train_ESRGAN.json and make the following changes:
- train : { dataroot_HR: location of the training HR images
- train : { dataroot_LR: location of the training LR images
- val : { dataroot_HR: location of the HR validation images
- val : { dataroot_LR: location of the LR validation images
- train : { HR_size: the size of the HR tiles. Leave at 128 if you're getting "out of memory" errors.
- train : { batch_size: You could lower this number if you're getting "out of memory" errors, but that produces
- errors on my Windows installation. "n_workers" may be an alternative.
- path : { root: the location of the BasicSR directory
- Again, make sure to use double shashes.
- 7. Use the command line to navigate to the codes folder and run this command: python train.py -opt
- options/train/train_esrgan.json
- You could also create a .bat file so you can just double click, though that does make it harder to find errors
- (as an error will close the command prompt instantly).
- 8. You can check on the model's progress by going into the "experiments" folder. Older sessions will have an
- "archived" in their name, while the latest session will not. Inside each folder is the "models" folder, which is
- where new models are saved, and the upscaled validation images will appear in "val_images". Once you're
- satisfied, hit Ctrl-C in the terminal to quit training.
- If you're feeling brave, you can mess with the GAN weight, feature weight and pixel weight in train_ESRGAN.json or initialize from a different model instead of RRDB_PSNR_x4.pth
- .:`
- .+dM.
- .sssssssso+dM.
- ``ys::://///+y+:`
- ``oh-. ``ohhhho.`
- `-+h:` :h+::::----
- -Ms +yyyyyyyy/:
- +oo: +ooooooNNoooooo+
- Nd +s+/+yMMMo+Md+hMo+s+
- Nd :d+- `dmMMMdh:+dmMdh:/d/
- Nd +M/ `mNMMMmd :mNMmd :Mo
- Nd +M/ `/ddd-` `+d-` :Mo
- :/yo :y+/` /: /+y:
- .ooooo :oooooooooooooooooo/
- `/yMdy :///////: `///mN
- `---hhhhhhh.```` hdhhhhhhhhdd/ dN
- ```````yhhdN/ mm````````/M+ dN
- ```+M/ yy:- /M+ dN
- -so+``so++++++oso+ss
- :+so .++++++oso+`
- :/hhhhhhhhs:.
- ........`
- (Oh christ I probably screwed up something here)
Advertisement
Add Comment
Please, Sign In to add comment