tamarott / SinGAN

Official pytorch implementation of the paper: "SinGAN: Learning a Generative Model from a Single Natural Image"
https://tamarott.github.io/SinGAN.htm
Other
3.3k stars 610 forks source link

How to use Harmonization code? #37

Open Johnson-yue opened 4 years ago

Johnson-yue commented 4 years ago

Hi, I think there are some question about use Harmonization, but those can not fix my problem , and the answer is blur. So I make a new issue.

How I use it :
Following ReadMe, First I train a image called "seascape.png" in Input/Images python main_train.py --input_name seacape.png and When the train processing have finished.I run python harmonization.py --input_name seacape.png --ref_name tree.png --harmonization_start_scale 2

why I set those parameters?Because follow by ReadMe ,like this: python harmonization.py --input_name <training_image_file_name> --ref_name <naively_pasted_reference_image_file_name> --harmonization_start_scale <scale to inject>

and I think is my first train image, so it is "seascape.png", and is Input/Harmonization/tree.jpg, so I set tree.jpg

I set 2 the result above , I got : ![Screenshot from 2019-11-22 10-20-31](https://user-images.githubusercontent.com/10268274/69392709-df4a1200-0d11-11ea-8154-4895851bb8df.png) it named **tree_mask_dilated.png** located in __Input/Harmonization__ and Other output is ![Screenshot from 2019-11-22 10-23-03](https://user-images.githubusercontent.com/10268274/69392777-191b1880-0d12-11ea-88c3-de2fd9e84a6c.png) it named **start_scale=2.png** located in __Output/Harmonization/seascape/tree_out__ Those are different from paper, So I want to know how to use it. **start_scale=5.png** image: ![Screenshot from 2019-11-22 11-26-19](https://user-images.githubusercontent.com/10268274/69395836-58019c00-0d1b-11ea-8af3-c548022640c7.png) **start_scale=6.png** image: ![Screenshot from 2019-11-22 11-26-26](https://user-images.githubusercontent.com/10268274/69395858-6cde2f80-0d1b-11ea-8eda-717b6acc8562.png) **start_scale=7.png** image: ![Screenshot from 2019-11-22 11-26-32](https://user-images.githubusercontent.com/10268274/69395873-74053d80-0d1b-11ea-8b15-6ce7bac8ef31.png) **start_scale=8.png** image: ![Screenshot from 2019-11-22 11-26-38](https://user-images.githubusercontent.com/10268274/69395881-79628800-0d1b-11ea-8482-ca517140be10.png) If you can reimplement result like paper, tell how to do it, thank you
tamarott commented 4 years ago

You should use higher value for harmonization_start_scale. You can play with this parameter until you'll get the desired result.

On Fri, Nov 22, 2019, 04:26 Johnson yue notifications@github.com wrote:

Hi, I think there are some question about use Harmonization, but those can not fix my problem , and the answer is blur. So I make a new issue.

How I use it : Following ReadMe, First I train a image called "seascape.png" in Input/Images python main_train.py --input_name seacape.png and When the train processing have finished.I run python harmonization.py --input_name seacape.png --ref_name tree.png --harmonization_start_scale 2

why I set those parameters?Because follow by ReadMe ,like this: python harmonization.py --input_name --ref_name

--harmonization_start_scale and I think is my first train image, so it is *"seascape.png"*, and is *Input/Harmonization/tree.jpg*, so I set *tree.jpg* I set 2 the result above , I got : [image: Screenshot from 2019-11-22 10-20-31] it named *tree_mask_dilated.png* located in *Input/Harmonization* and Other output is [image: Screenshot from 2019-11-22 10-23-03] it named *start_scale=2.png* located in *Output/Harmonization/seascape/tree_out* Those are different from paper, So I want to know how to use it. If you can reimplement result like paper, tell how to do it, thank you — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub , or unsubscribe .
Johnson-yue commented 4 years ago

You should use higher value for harmonization_start_scale. You can play with this parameter until you'll get the desired result. On Fri, Nov 22, 2019, 04:26 Johnson yue @.**> wrote: Hi, I think there are some question about use Harmonization, but those can not fix my problem , and the answer is blur. So I make a new issue. How I use it : Following ReadMe, First I train a image called "seascape.png" in Input/Images python main_train.py --input_name seacape.png and When the train processing have finished.I run python harmonization.py --input_name seacape.png --ref_name tree.png --harmonization_start_scale 2 why I set those parameters?Because follow by ReadMe ,like this: python harmonization.py --input_name --ref_name --harmonization_start_scale and I think is my first train image, so it is "seascape.png", and is Input/Harmonization/tree.jpg, so I set tree.jpg I set 2 the result above , I got : [image: Screenshot from 2019-11-22 10-20-31] https://user-images.githubusercontent.com/10268274/69392709-df4a1200-0d11-11ea-8154-4895851bb8df.png it named tree_mask_dilated.png located in Input/Harmonization and Other output is [image: Screenshot from 2019-11-22 10-23-03] https://user-images.githubusercontent.com/10268274/69392777-191b1880-0d12-11ea-88c3-de2fd9e84a6c.png it named start_scale=2.png located in Output/Harmonization/seascape/tree_out* Those are different from paper, So I want to know how to use it. If you can reimplement result like paper, tell how to do it, thank you — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#37?email_source=notifications&email_token=AM5V37JC7EBAZQ2STABTCGTQU47NZA5CNFSM4JQKZE62YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4H3ITNTA>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AM5V37M3FB22LQWWMK5VLVTQU47NZANCNFSM4JQKZE6Q .

yes, I use 2 to 8 for test, and the result image at above , do you had any better result?

tamarott commented 4 years ago

This is the result I get with start_scale=6: start_scale=6 Did you change anything within the function?

Johnson-yue commented 4 years ago

This is the result I get with start_scale=6: start_scale=6 Did you change anything within the function?

No, I do not change anything , Maybe I should try it again, what is the Input/Harmonization/tree_mask_dilated.png look like ? It is same to me ?or different ?

fookseng commented 2 years ago

Hello Sir, I was running exactly like you, but get the error "ValueError: the input array must have size 3 along channel_axis, got (202, 250) " after running python harmonization.py --input_name seascape.png --ref_name tree.jpg --harmonization_start_scale 1. Do you have any idea what has caused this issue? Thank you ~