Comments (12)
you have to set the desired width and height in config.py and songToData.py
[EDIT: >THIS IS WRONG!]
from pytorch-cyclegan-and-pix2pix.
It only depends on the generator. You are free to use 'resnet_6blocks' or 'resnet_9blocks' which should support some rectangular inputs. I think 'unet_128' and 'unet_256' only support square input images. There are other workaround solutions. (1) You can load the image as rectangular images, and crop square patches for example. Or (2) resize the image to a square image, run the training/test, and resize the result back to the original rectangular image during the test time.
from pytorch-cyclegan-and-pix2pix.
yeah you get this error because you're using the "aligned" mode, but the code in my fork is only modified to work on rectangular images with the "unaligned" mode.
from pytorch-cyclegan-and-pix2pix.
I try to modify the aligned_dataset.py as follows:
AB = AB.resize((160 * 2, 70), Image.BICUBIC)
AB = self.transform(AB)
self.opt.loadSize = 160
self.opt.fineSize = 160
Here the size of my image is 160*70pix,but error occurs when runing train.py. The erroe messagge is:
RuntimeError: CUDNN_STATUS_BAD_PARAM
I don't know where is wrong. Did you solved it? @ianni67
In addition, can the program only to train square images? @junyanz
Thank you.
from pytorch-cyclegan-and-pix2pix.
The current code assumes width==height
. However, it is possible to modify the code to work on the rectangular cases. You need to modify the dataset class under /data
subdirectory.
from pytorch-cyclegan-and-pix2pix.
Thank you very much for your kind response. I made a fork of the project, where I'm playing with the code. I hope you don't mind. If I find anything useful, I'll let you know.
Currently my main change actually implements the change in the size of the slices, as described in the changelog.
from pytorch-cyclegan-and-pix2pix.
Can the forking project train the rectangle images? If it can, how to set the options? @junyanz
from pytorch-cyclegan-and-pix2pix.
Thanks. But I didn't find the config.py and songToData.py in the project. Could you give me a link? Thanks again.
from pytorch-cyclegan-and-pix2pix.
I'm very sorry. I got confused in my previous post, as I have two related projects with similar issues.
The height has to be passed as a parameter in your command line, see the file base_options.py in the options folder.
Also make sure that --resize_or_crop is set to no-resize
and the no-flip switch is set in your command line.
from pytorch-cyclegan-and-pix2pix.
Got it. Thanks for your timely replay. Suppose the size of the image is 160*70pix. I can set in the command line as "--loadSize 160 --loadHeight 70 --resize_or_crop no_resize no_flip". Isn't is?
When I train the mode as follows, the error occurs:
python train.py --dataroot ./datasets/captcha/ --name captcha_mdoel --model pix2pix --which_model_netG unet_256 --which_direction AtoB --lambda_A 100 --dataset_mode aligned --use_dropout --no_lsgan --norm batch --loadSize 100 --loadHeight 70 --resize_or_crop no_resize --no_flip
errors:
CustomDatasetDataLoader
dataset [AlignedDataset] was created
Traceback (most recent call last):
File "train.py", line 8, in
data_loader = CreateDataLoader(opt)
File "/home/gxy/kx/program/pytorch-CycleGAN-and-pix2pix/data/data_loader.py", line 6, in CreateDataLoader
data_loader.initialize(opt)
File "/home/gxy/kx/program/pytorch-CycleGAN-and-pix2pix/data/custom_dataset_data_loader.py", line 30, in initialize
self.dataset = CreateDataset(opt)
File "/home/gxy/kx/program/pytorch-CycleGAN-and-pix2pix/data/custom_dataset_data_loader.py", line 20, in CreateDataset
dataset.initialize(opt)
File "/home/gxy/kx/program/pytorch-CycleGAN-and-pix2pix/data/aligned_dataset.py", line 18, in initialize
assert(opt.resize_or_crop == 'resize_and_crop')
AssertionError
from pytorch-cyclegan-and-pix2pix.
When I use the unaligned dataset. I encounter the error as follows:
------------ Options -------------
batchSize: 1
beta1: 0.5
checkpoints_dir: ./checkpoints
continue_train: False
dataroot: ./datasets/captcha/
dataset_mode: unaligned
display_freq: 100
display_id: 1
display_port: 8097
display_single_pane_ncols: 0
display_winsize: 256
fineSize: 100
gpu_ids: [0]
identity: 0.0
input_nc: 3
isTrain: True
lambda_A: 100.0
lambda_B: 10.0
loadSize: 100
lr: 0.0002
max_dataset_size: inf
model: pix2pix
nThreads: 2
n_layers_D: 3
name: captcha_model
ndf: 64
ngf: 64
niter: 100
niter_decay: 100
no_flip: False
no_html: False
no_lsgan: True
norm: batch
output_nc: 3
phase: train
pool_size: 50
print_freq: 100
resize_or_crop: scale_width
save_epoch_freq: 5
save_latest_freq: 5000
serial_batches: False
use_dropout: False
which_direction: AtoB
which_epoch: latest
which_model_netD: basic
which_model_netG: unet_256
-------------- End ----------------
CustomDatasetDataLoader
dataset [UnalignedDataset] was created
#training images = 20000
pix2pix
Traceback (most recent call last):
File "train.py", line 13, in
model = create_model(opt)
File "/home/nisl/gxye/program/pytorch-CycleGAN-and-pix2pix_rectangle/models/models.py", line 10, in create_model
assert(opt.dataset_mode == 'aligned')
AssertionError
Where the command line as follows:
python train.py --dataroot ./datasets/captcha/ --name captcha_model --model pix2pix --which_model_netG unet_256 --which_direction AtoB --lambda_A 100 --dataset_mode unaligned --no_lsgan --norm batch --loadSize 100 --fineSize 100 --resize_or_crop scale_width
I read the code in details to analyze the reason and found that the pix2pix model has to use the aligned dataset. That is the training images must to be square using pix2pix model. Isn't it? Sorry for do not clear which model that I used before. Nevertheless, Thank you very much.
from pytorch-cyclegan-and-pix2pix.
@yeguixin yes you are right. At the time being, the code for pix2pix still requires square image.
from pytorch-cyclegan-and-pix2pix.
Related Issues (20)
- 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
- How to use test.py to test both directions for cyclegan? HOT 1
- CycleGAN model transferring the object rather than the style
- Loading issue in trained model
- SAR to Optical image generation
- 礼貌提问并虚心请教:线性衰减学习率政策
- 请问作者 HOT 1
- 生成图像的质量太低怎么办
- 请问对于输入图像大小不一样时,该代码中是否对图像进行预处理了呢?
- CPU
- 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
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.