Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it able to work with python3.6 #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*.jpg
*.png
*.pyc
example_weights
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"python.pythonPath": "/home/kda/.pyenv/versions/3.6.9/bin/python"
}
8 changes: 4 additions & 4 deletions kaffe/tensorflow/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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')
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion wasr_inference_noimu_general.py
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand Down