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

Does it work in tensorflow v1.0.0? #19

Open
yt7589 opened this issue Apr 30, 2017 · 2 comments
Open

Does it work in tensorflow v1.0.0? #19

yt7589 opened this issue Apr 30, 2017 · 2 comments

Comments

@yt7589
Copy link

yt7589 commented Apr 30, 2017

It is a great library. But when I use tensorflow v1.0.0 it didn't work.

My code:
class FcvImgSeg(object):
def init(self):
print('init')
self.slim = tf.contrib.slim
self.fcv_ckpt_path = './models/lcct/model_fcn8s_final.ckpt'
self.number_of_classes = 21
self.img_filename = './work/cat.jpg'

def seg_img_fcv(self, img_filename):
    print('segmentation image by fully convalutional vgg v0.0.4')
    img_filename_plhr = tf.placeholder(tf.string)
    fcv_feed_dict = {img_filename_plhr: img_filename}
    img_content = tf.read_file(img_filename_plhr)
    img_tensor = tf.image.decode_jpeg(img_content, channels=3)
    image_batch_tensor = tf.expand_dims(img_tensor, axis=0)
    fcn_8s = adapt_network_for_any_size_input(FCN_8s, 32)
    pred, fcn_16s_variables_mapping = FCN_8s(image_batch_tensor=image_batch_tensor,
                                      number_of_classes=self.number_of_classes,
                                      is_training=False)
    initializer = tf.local_variables_initializer()
    saver = tf.train.Saver()
    with tf.Session() as sess:
        sess.run(initializer)
        saver.restore(sess, "/home/dpakhom1/tf_projects/segmentation/model_fcn8s_final.ckpt")
        image_np, pred_np = sess.run([img_tensor, pred], feed_dict=fcv_feed_dict)
        io.imshow(image_np)
        io.show()
        io.imshow(pred_np.squeeze())
        io.show()

It reported errors as below:

Traceback (most recent call last):
File "exp.py", line 24, in
test()
File "exp.py", line 12, in test
fcv_img_seg.seg_img_fcv('e:\awork\dlp\work\lcct\cat.jpg')
File "E:\awork\dlp\apps\lcct\fcv_img_seg.py", line 45, in seg_img_fcv
is_training=False)
File "./lib/tfis\tf_image_segmentation\models\fcn_8s.py", line 81, in FCN_8s
fc_conv_padding='SAME')
File "./lib\fcv\models\slim\nets\vgg.py", line 166, in vgg_16
net = slim.repeat(inputs, 2, slim.conv2d, 64, [3, 3], scope='conv1')
File "E:\software\Anaconda3\envs\wky351\lib\site-packages\tensorflow\contrib\layers\python\layers\layers.py", line 1735, in repeat
outputs = layer(outputs, *args, **kwargs)
File "E:\software\Anaconda3\envs\wky351\lib\site-packages\tensorflow\contrib\framework\python\ops\arg_scope.py", line 177, in func_with_args
return func(*args, **current_args)
File "E:\software\Anaconda3\envs\wky351\lib\site-packages\tensorflow\contrib\layers\python\layers\layers.py", line 907, in convolution
outputs = layer.apply(inputs)
File "E:\software\Anaconda3\envs\wky351\lib\site-packages\tensorflow\python\layers\base.py", line 323, in apply
return self.call(inputs, **kwargs)
File "E:\software\Anaconda3\envs\wky351\lib\site-packages\tensorflow\python\layers\base.py", line 289, in call
self.build(input_shapes[0])
File "E:\software\Anaconda3\envs\wky351\lib\site-packages\tensorflow\python\layers\convolutional.py", line 145, in build
dtype=self.dtype)
File "E:\software\Anaconda3\envs\wky351\lib\site-packages\tensorflow\python\ops\variable_scope.py", line 1034, in get_variable
use_resource=use_resource, custom_getter=custom_getter)
File "E:\software\Anaconda3\envs\wky351\lib\site-packages\tensorflow\python\ops\variable_scope.py", line 933, in get_variable
use_resource=use_resource, custom_getter=custom_getter)
File "E:\software\Anaconda3\envs\wky351\lib\site-packages\tensorflow\python\ops\variable_scope.py", line 349, in get_variable
validate_shape=validate_shape)
File "E:\software\Anaconda3\envs\wky351\lib\site-packages\tensorflow\python\layers\base.py", line 278, in variable_getter
variable_getter=functools.partial(getter, **kwargs))
File "E:\software\Anaconda3\envs\wky351\lib\site-packages\tensorflow\python\layers\base.py", line 228, in _add_variable
trainable=trainable and self.trainable)
File "E:\software\Anaconda3\envs\wky351\lib\site-packages\tensorflow\contrib\layers\python\layers\layers.py", line 1325, in layer_variable_getter
return _model_variable_getter(getter, *args, **kwargs)
File "E:\software\Anaconda3\envs\wky351\lib\site-packages\tensorflow\contrib\layers\python\layers\layers.py", line 1314, in _model_variable_getter
custom_getter=getter)
File "E:\software\Anaconda3\envs\wky351\lib\site-packages\tensorflow\contrib\framework\python\ops\arg_scope.py", line 177, in func_with_args
return func(*args, **current_args)
File "E:\software\Anaconda3\envs\wky351\lib\site-packages\tensorflow\contrib\framework\python\ops\variables.py", line 255, in model_variable
partitioner=partitioner, custom_getter=custom_getter)
File "E:\software\Anaconda3\envs\wky351\lib\site-packages\tensorflow\contrib\framework\python\ops\arg_scope.py", line 177, in func_with_args
return func(*args, **current_args)
File "E:\software\Anaconda3\envs\wky351\lib\site-packages\tensorflow\contrib\framework\python\ops\variables.py", line 212, in variable
partitioner=partitioner)
File "E:\software\Anaconda3\envs\wky351\lib\site-packages\tensorflow\python\ops\variable_scope.py", line 341, in _true_getter
use_resource=use_resource)
File "E:\software\Anaconda3\envs\wky351\lib\site-packages\tensorflow\python\ops\variable_scope.py", line 711, in _get_single_variable
validate_shape=validate_shape)
File "E:\software\Anaconda3\envs\wky351\lib\site-packages\tensorflow\python\ops\variables.py", line 197, in init
expected_shape=expected_shape)
File "E:\software\Anaconda3\envs\wky351\lib\site-packages\tensorflow\python\ops\variables.py", line 275, in _init_from_args
initial_value(), name="initial_value", dtype=dtype)
File "E:\software\Anaconda3\envs\wky351\lib\site-packages\tensorflow\python\ops\variable_scope.py", line 687, in
shape.as_list(), dtype=dtype, partition_info=partition_info)
TypeError: init() got multiple values for argument 'dtype'

@nealmcb
Copy link

nealmcb commented May 9, 2017

Looks like #20 and #8 are relevant, given the significant changes in the API for Tensorflow 1.0.
Perhaps the PR there will help: Fix for #8: make forward/backward compatible with tf-1.0.x..

@ahundt
Copy link

ahundt commented May 15, 2017

try applying my pull request, I'm running it on tf 1.1 #7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants