Closed gaylejj closed 6 years ago
The script expects the namespace for the model to be the same as the filename for the .pb file - sorry this was not anywhere in the README! The default model name is "model" so if you didn't specify a name when training, naming the file model.pb ought to work.
I will put up the script I used to export pb files so hopefully that won't be an issue after I clean it up a bit
Ahh gotcha. I'll try again in the morning. I had renamed the file, but not to what I specified in the python command.
OK let me know if it works!
So that worked for finding the Tensor, but now I'm getting a new error, which looks like a matrix error.
The styling script expects a tensor of shape 1 x image_height x image_width x 3 but the training script has a shape batch_size x image_height x image_width x 3 - when you freeze the pb file you'll have to make sure when you load the StyleTransfer model you set the batch size to 1 so something like
train_model = style_transfer.StyleTransfer( is_training=False, batch_size=1, image_h=args.image_h, image_w=args.image_w, model=args.generator)
Ok, I think I understand. So when I set the training, with train.py I need to specify the batch-size of 1?
Alright, getting closer...
Now running the command python style.py --model_file=./diving.pb --input=./puppy.jpg --output=./puppy_diving.jpg after training with python train.py --data_dir=./val2014 --texture=diving.jpg --model_name=diving --batch_size=1, I get the following
Thanks again for all your help, this is a super cool project!
I uploaded my export script - can you try it out? You run it with
python export.py input_dir=your-models-path
and it outputs a .pb file in that path
I'm trying to style an image based on a model I trained, but keep getting a Tensorflow error about not being able to find the Tensor.
I tried specifying the model file in the arguments as --model_file=./diving.pb (with file in my main directory), as well as placing it in the data folder and replacing the default argument in style.py with my file name. I get the same error every time. Is there something I am missing when specifying the file?