diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..be103a6 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +*.jpg +*.png +*.pyc +example_weights \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..5676b26 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "python.pythonPath": "/home/kda/.pyenv/versions/3.6.9/bin/python" +} \ No newline at end of file diff --git a/kaffe/tensorflow/network.py b/kaffe/tensorflow/network.py index 0fe15d1..8df11e0 100644 --- a/kaffe/tensorflow/network.py +++ b/kaffe/tensorflow/network.py @@ -79,7 +79,7 @@ def feed(self, *args): assert len(args) != 0 self.terminals = [] for fed_layer in args: - if isinstance(fed_layer, basestring): + if isinstance(fed_layer, str): try: #print('Layer ' + fed_layer + ' shape') #print(self.layers[fed_layer].shape) @@ -121,7 +121,7 @@ def attention_refinment_module(self, input, name): @layer def attention_refinment_module_new(self, input, name, last_arm=False): global_pool = tf.reduce_mean(input, [1, 2], keep_dims=True) - conv_1 = keras_ly.Conv2D(input.get_shape()[3], [1, 1], padding='SAME', name=name+'_conv1')(global_pool) + conv_1 = keras_ly.Conv2D(int(input.get_shape()[3]), [1, 1], padding='SAME', name=name+'_conv1')(global_pool) with tf.variable_scope(name+'_conv1_bn') as scope: conv_1_bn = slim.batch_norm(conv_1, fused=True, scope=scope) sigmoid = tf.sigmoid(conv_1_bn, name=name+'_sigmoid') @@ -214,7 +214,7 @@ def conv(self, # Verify that the padding is acceptable self.validate_padding(padding) # Get the number of channels in the input - c_i = input.get_shape()[-1] + c_i = int(input.get_shape()[-1]) # Verify that the grouping parameter is valid assert c_i % group == 0 assert c_o % group == 0 @@ -256,7 +256,7 @@ def atrous_conv(self, # Verify that the padding is acceptable self.validate_padding(padding) # Get the number of channels in the input - c_i = input.get_shape()[-1] + c_i = int(input.get_shape()[-1]) # Verify that the grouping parameter is valid assert c_i % group == 0 assert c_o % group == 0 diff --git a/wasr_inference_noimu_general.py b/wasr_inference_noimu_general.py index 7034208..e97b7c9 100644 --- a/wasr_inference_noimu_general.py +++ b/wasr_inference_noimu_general.py @@ -124,7 +124,10 @@ def main(): os.makedirs(args.save_dir) # Read image - img_in = cv2.imread(os.path.join(args.dataset_path, args.img_path)) + # img_in = cv2.imread(os.path.join(args.dataset_path, args.img_path)) + img_in = cv2.imread(os.path.join(args.img_path)) + assert img_in is not None + img_in = cv2.resize(img_in, (IMG_SIZE[1], IMG_SIZE[0])) # Run inference preds = sess.run(pred, feed_dict={img_input: img_in})