Skip to content

Commit

Permalink
Fix "tuple index out of range" bug
Browse files Browse the repository at this point in the history
  • Loading branch information
titu1994 committed Jun 24, 2017
1 parent 8c5597d commit 6a27fc3
Show file tree
Hide file tree
Showing 10 changed files with 75 additions and 41 deletions.
3 changes: 3 additions & 0 deletions .idea/dictionaries/Yue.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/markdown-exported-files.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion INetwork.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ def pooling_func(x):
else:
shape = (nb_tensors, img_width, img_height, 3)

ip = Input(tensor=input_tensor, shape=shape)
ip = Input(tensor=input_tensor, batch_shape=shape)

# build the VGG16 network with our 3 images as input
x = Convolution2D(64, (3, 3), activation='relu', name='conv1_1', padding='same')(ip)
Expand Down
2 changes: 1 addition & 1 deletion Network.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ def pooling_func(x):
else:
shape = (nb_tensors, img_width, img_height, 3)

ip = Input(tensor=input_tensor, shape=shape)
ip = Input(tensor=input_tensor, batch_shape=shape)

# build the VGG16 network with our 3 images as input
x = Convolution2D(64, (3, 3), activation='relu', name='conv1_1', padding='same')(ip)
Expand Down
36 changes: 18 additions & 18 deletions script_helper/Script/INetwork.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from keras.utils.layer_utils import convert_all_kernels_in_model

"""
Neural Style Transfer with Keras 1.1.2
Neural Style Transfer with Keras 1.2.2
Based on:
https://github.com/fchollet/keras/blob/master/examples/neural_style_transfer.py
Expand Down Expand Up @@ -313,36 +313,36 @@ def pooling_func(x):
else:
shape = (nb_tensors, img_width, img_height, 3)

ip = Input(tensor=input_tensor, shape=shape)
ip = Input(tensor=input_tensor, batch_shape=shape)

# build the VGG16 network with our 3 images as input
x = Convolution2D(64, 3, 3, activation='relu', name='conv1_1', border_mode='same')(ip)
x = Convolution2D(64, 3, 3, activation='relu', name='conv1_2', border_mode='same')(x)
x = Convolution2D(64, (3, 3), activation='relu', name='conv1_1', padding='same')(ip)
x = Convolution2D(64, (3, 3), activation='relu', name='conv1_2', padding='same')(x)
x = pooling_func(x)

x = Convolution2D(128, 3, 3, activation='relu', name='conv2_1', border_mode='same')(x)
x = Convolution2D(128, 3, 3, activation='relu', name='conv2_2', border_mode='same')(x)
x = Convolution2D(128, (3, 3), activation='relu', name='conv2_1', padding='same')(x)
x = Convolution2D(128, (3, 3), activation='relu', name='conv2_2', padding='same')(x)
x = pooling_func(x)

x = Convolution2D(256, 3, 3, activation='relu', name='conv3_1', border_mode='same')(x)
x = Convolution2D(256, 3, 3, activation='relu', name='conv3_2', border_mode='same')(x)
x = Convolution2D(256, 3, 3, activation='relu', name='conv3_3', border_mode='same')(x)
x = Convolution2D(256, (3, 3), activation='relu', name='conv3_1', padding='same')(x)
x = Convolution2D(256, (3, 3), activation='relu', name='conv3_2', padding='same')(x)
x = Convolution2D(256, (3, 3), activation='relu', name='conv3_3', padding='same')(x)
if args.model == "vgg19":
x = Convolution2D(256, 3, 3, activation='relu', name='conv3_4', border_mode='same')(x)
x = Convolution2D(256, (3, 3), activation='relu', name='conv3_4', padding='same')(x)
x = pooling_func(x)

x = Convolution2D(512, 3, 3, activation='relu', name='conv4_1', border_mode='same')(x)
x = Convolution2D(512, 3, 3, activation='relu', name='conv4_2', border_mode='same')(x)
x = Convolution2D(512, 3, 3, activation='relu', name='conv4_3', border_mode='same')(x)
x = Convolution2D(512, (3, 3), activation='relu', name='conv4_1', padding='same')(x)
x = Convolution2D(512, (3, 3), activation='relu', name='conv4_2', padding='same')(x)
x = Convolution2D(512, (3, 3), activation='relu', name='conv4_3', padding='same')(x)
if args.model == "vgg19":
x = Convolution2D(512, 3, 3, activation='relu', name='conv4_4', border_mode='same')(x)
x = Convolution2D(512, (3, 3), activation='relu', name='conv4_4', padding='same')(x)
x = pooling_func(x)

x = Convolution2D(512, 3, 3, activation='relu', name='conv5_1', border_mode='same')(x)
x = Convolution2D(512, 3, 3, activation='relu', name='conv5_2', border_mode='same')(x)
x = Convolution2D(512, 3, 3, activation='relu', name='conv5_3', border_mode='same')(x)
x = Convolution2D(512, (3, 3), activation='relu', name='conv5_1', padding='same')(x)
x = Convolution2D(512, (3, 3), activation='relu', name='conv5_2', padding='same')(x)
x = Convolution2D(512, (3, 3), activation='relu', name='conv5_3', padding='same')(x)
if args.model == "vgg19":
x = Convolution2D(512, 3, 3, activation='relu', name='conv5_4', border_mode='same')(x)
x = Convolution2D(512, (3, 3), activation='relu', name='conv5_4', padding='same')(x)
x = pooling_func(x)

model = Model(ip, x)
Expand Down
37 changes: 18 additions & 19 deletions script_helper/Script/Network.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

from scipy.misc import imread, imresize, imsave, fromimage, toimage
from scipy.optimize import fmin_l_bfgs_b
import numpy as np
Expand All @@ -14,7 +13,7 @@
from keras.utils.layer_utils import convert_all_kernels_in_model

"""
Neural Style Transfer with Keras 1.1.2
Neural Style Transfer with Keras 1.2.2
Based on:
https://github.com/fchollet/keras/blob/master/examples/neural_style_transfer.py
Expand Down Expand Up @@ -311,36 +310,36 @@ def pooling_func(x):
else:
shape = (nb_tensors, img_width, img_height, 3)

ip = Input(tensor=input_tensor, shape=shape)
ip = Input(tensor=input_tensor, batch_shape=shape)

# build the VGG16 network with our 3 images as input
x = Convolution2D(64, 3, 3, activation='relu', name='conv1_1', border_mode='same')(ip)
x = Convolution2D(64, 3, 3, activation='relu', name='conv1_2', border_mode='same')(x)
x = Convolution2D(64, (3, 3), activation='relu', name='conv1_1', padding='same')(ip)
x = Convolution2D(64, (3, 3), activation='relu', name='conv1_2', padding='same')(x)
x = pooling_func(x)

x = Convolution2D(128, 3, 3, activation='relu', name='conv2_1', border_mode='same')(x)
x = Convolution2D(128, 3, 3, activation='relu', name='conv2_2', border_mode='same')(x)
x = Convolution2D(128, (3, 3), activation='relu', name='conv2_1', padding='same')(x)
x = Convolution2D(128, (3, 3), activation='relu', name='conv2_2', padding='same')(x)
x = pooling_func(x)

x = Convolution2D(256, 3, 3, activation='relu', name='conv3_1', border_mode='same')(x)
x = Convolution2D(256, 3, 3, activation='relu', name='conv3_2', border_mode='same')(x)
x = Convolution2D(256, 3, 3, activation='relu', name='conv3_3', border_mode='same')(x)
x = Convolution2D(256, (3, 3), activation='relu', name='conv3_1', padding='same')(x)
x = Convolution2D(256, (3, 3), activation='relu', name='conv3_2', padding='same')(x)
x = Convolution2D(256, (3, 3), activation='relu', name='conv3_3', padding='same')(x)
if args.model == "vgg19":
x = Convolution2D(256, 3, 3, activation='relu', name='conv3_4', border_mode='same')(x)
x = Convolution2D(256, (3, 3), activation='relu', name='conv3_4', padding='same')(x)
x = pooling_func(x)

x = Convolution2D(512, 3, 3, activation='relu', name='conv4_1', border_mode='same')(x)
x = Convolution2D(512, 3, 3, activation='relu', name='conv4_2', border_mode='same')(x)
x = Convolution2D(512, 3, 3, activation='relu', name='conv4_3', border_mode='same')(x)
x = Convolution2D(512, (3, 3), activation='relu', name='conv4_1', padding='same')(x)
x = Convolution2D(512, (3, 3), activation='relu', name='conv4_2', padding='same')(x)
x = Convolution2D(512, (3, 3), activation='relu', name='conv4_3', padding='same')(x)
if args.model == "vgg19":
x = Convolution2D(512, 3, 3, activation='relu', name='conv4_4', border_mode='same')(x)
x = Convolution2D(512, (3, 3), activation='relu', name='conv4_4', padding='same')(x)
x = pooling_func(x)

x = Convolution2D(512, 3, 3, activation='relu', name='conv5_1', border_mode='same')(x)
x = Convolution2D(512, 3, 3, activation='relu', name='conv5_2', border_mode='same')(x)
x = Convolution2D(512, 3, 3, activation='relu', name='conv5_3', border_mode='same')(x)
x = Convolution2D(512, (3, 3), activation='relu', name='conv5_1', padding='same')(x)
x = Convolution2D(512, (3, 3), activation='relu', name='conv5_2', padding='same')(x)
x = Convolution2D(512, (3, 3), activation='relu', name='conv5_3', padding='same')(x)
if args.model == "vgg19":
x = Convolution2D(512, 3, 3, activation='relu', name='conv5_4', border_mode='same')(x)
x = Convolution2D(512, (3, 3), activation='relu', name='conv5_4', padding='same')(x)
x = pooling_func(x)

model = Model(ip, x)
Expand Down
2 changes: 1 addition & 1 deletion script_helper/Script/improved_neural_doodle.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from keras.applications import vgg16

"""
Neural Doodle in Keras using Keras 1.0.8+
Neural Doodle in Keras using Keras 1.2.2
Based on the original script available at : https://github.com/fchollet/keras/blob/master/examples/neural_doodle.py
Expand Down
2 changes: 1 addition & 1 deletion script_helper/Script/neural_doodle.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from keras.applications import vgg16

"""
Neural Doodle in Keras using Keras 1.0.8+
Neural Doodle in Keras using Keras 1.2.2
Based on the original script available at : https://github.com/fchollet/keras/blob/master/examples/neural_doodle.py
Expand Down

0 comments on commit 6a27fc3

Please sign in to comment.