Open hydwjy opened 2 years ago
If you have your own dataset, you need to prepare them as follow: let's say you have a folder called "blurred_sharp" in the directory that you cloned "DeblurGAN-master". you make two sub-folders and let's call them "blurred" and "sharp". In each of these folders, again you need to make two subfolders and call them "train" and "test". So now you have:
-DeblurGAN-master
- blurred_sharp
- blurred
- train
- test
- sharp
- train
- test
You need to put your sharp and blurred images in these folders accordingly. Make sure for example, when you put the blurred image, in the "..\blurred\train" folder, you put it's associate sharp image in "..\sharp\train" folder.
Now you need to create another folder, let's call it "combine" and put it in the following directory: ..\DeblurGAN-master\blurred_sharp\combine
via cmd or VScode (any platform that you are using) go to the "DeblurGAN-master" folder and "run combine_A_and_B.py". below is an example:
python datasets/combine_A_and_B.py --fold_A "C:\TEMP\DeblurGAN-master\blurred_sharp\blurred" --fold_B "C:\TEMP\DeblurGAN-master\blurred_sharp\sharp" --fold_AB "C:\TEMP\DeblurGAN-master\blurred_sharp\combine"
It will create two subfolders (train and test) in the "combine" folder that you created earlier. You will see the blurred and sharp images concatenated.
Now make sure you have visdom package correctly installed in your python. Then open cmd and run:
python -m visdom.server
you will probably get the following message:
Then copy/paste "http://localhost:8097" in your browser to be able to monitor the training progress.
now you can run the following code for training:
python train.py --dataroot "C:\TEMP\DeblurGAN-master\blurred_sharp\combine" --learn_residual --resize_or_crop crop --fineSize 256
When the training is completed after 300 epochs, put your test images in a folder (let's say "..\DeblurGAN-master\TEST" ). Now you can test it with the following command.
python test.py --dataroot "C:\TEMP_TEST\DeblurGAN-master\TEST" --model test --dataset_mode single --learn_residual
remember if your device cannot handle parallel processing, in the "test.py" change the number of threads to zero as follow: opt.nThreads = 0
We can't get the result of deblur type after testing a blurry image. What should we do? do we need to combine a blurry and sharp image like in the process of training? Also is it possible to select particular region only of the image to deblur? something like comparative between an entire image and the selected part region of the image, thank you!
below our own test image that showed in the results after testing it.
I want to train my dataset and what to do