Comments (7)
I was tired of waiting so I decided writing my own. It takes real_A.jpg
as input and generates fake_B.png
. You can parse images location as arguments as you need:
# Load model
model = create_model(opt)
# Load image
real = Image.open('./real_A.jpg')
preprocess = transforms.Compose([
transforms.Scale(opt.loadSize),
transforms.RandomCrop(opt.fineSize),
transforms.ToTensor(),
transforms.Normalize((0.5, 0.5, 0.5),
(0.5, 0.5, 0.5)),
])
# Load input
input_A = preprocess(real).unsqueeze_(0)
model.input_A.resize_(input_A.size()).copy_(input_A)
# Forward (model.real_A) through G and produce output (model.fake_B)
model.test()
# Convert image to numpy array
fake = util.tensor2im(model.fake_B.data)
# Save image
util.save_image(fake, './fake_B.png')
You can check full example here: https://gist.github.com/hiepph/125ebe0795ca9f5bfac3328b4d604928
And you run it with, for example:
python gen.py --dataroot datasets --name edges2shoes_pix2pix
--dataroot
is a must option of base options so I just add a random value here. It matters at --name
---> the name of the trained model.
from pytorch-cyclegan-and-pix2pix.
We will provide a test code for single image after NIPS deadline (May 19). For now, you can create a placeholder image B (e.g. white image).
from pytorch-cyclegan-and-pix2pix.
i also don't know how to do, did you make any progress? thks @jinfagang
and if there is any advises you can provide? @junyanz @phillipi
from pytorch-cyclegan-and-pix2pix.
Hi @junyanz, It's already May 23. Did you make any progress for this issue? Maybe a script, if I input an A image, it will produce a B generated image with trained model?
from pytorch-cyclegan-and-pix2pix.
@hiepph You are just waiting something as I am.
from pytorch-cyclegan-and-pix2pix.
Thanks, @hiepph for sharing the helpful script. Sorry for the delay. I just uploaded a new script for applying a pre-trained model to a collection of input images. Please use --dataset_mode single
and --model test
options.
from pytorch-cyclegan-and-pix2pix.
666
from pytorch-cyclegan-and-pix2pix.
Related Issues (20)
- 我研究和改进pix2pix,如果对GAN或者pix2pix感兴趣的可以联系我,联系方式,wechat: lovedaixiaobaby HOT 1
- Cycle_A loss suddenly becomes very high HOT 1
- poor test results - > recommendations for improvement HOT 1
- Question about Cyclegan's FCN SCORE source code
- [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed - error while running the server on macOS
- Could not connect to the server for the viewing page. HOT 1
- how i use my generator in an another app?
- Is there a sample I can use to paint an image without cutting it?
- wandb & visdom question HOT 1
- Generate photorealistic images from human-drawn sketches using GANs - any model suggestions? HOT 1
- Is it normal to use 2 black and white images? HOT 7
- AssertionError: .\datasets\wys_cyclegan_dataset\train is not a valid directory
- Training the model on custom dataset
- pix2pix architecture differs from original paper
- Adding "Cite This Repository" Option
- losses not getting logged to wandb anymore? HOT 2
- How to generate an image and its corresponding mask at the same time?
- Exception in user code
- Not able to load a pre trained weight that I have used for training of custom data. HOT 4
- oserror: errno 24 too many open files HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pytorch-cyclegan-and-pix2pix.