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)
- 请问作者 HOT 1
- 生成图像的质量太低怎么办
- 请问对于输入图像大小不一样时,该代码中是否对图像进行预处理了呢?
- CPU HOT 1
- It gets stuck when running for more than 20 rounds, but the graphics card is still running. What is the reason for this?
- Is the Model Capable of Processing and Maintaining Consistent Output Sizes Across Varied Image Dimensions? HOT 6
- 请问测试集应该下载保存到什么文件夹呢,每次都会报错'./checkpoints\\facades_label2photo_pretrained\\latest_net_G.pth'
- Hello, HOT 1
- introducing CycleGAN-Turbo and pix2pix-turbo
- Add ROI specific loss function to generator
- Error testing my own dataset using pix2pix
- How can I train with multi-input like (A1 ,A2……)->B? HOT 1
- How to finish Scene Text Editing task using Pix2Pix
- Input images are stretched when using test HOT 1
- Error in combine_A_and_B.py for TIFF-files
- Training Parameters or Architecture Settings Recommendations
- Perform interpolation between Input and Output
- value of lambda_identity not to change the color
- good
- The test results with pix2pix were poor
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.