GithubHelp home page GithubHelp logo

tensorflow_notes's People

Contributors

warmspringwinds avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tensorflow_notes's Issues

Upgrade to tf v1 api

For tensorflow_notes/simple_classification_segmentation.ipynb, may it be possible to upgrade to tf v1 API? For a beginner like myself, this tutorial is amazing. Cheers!

about discrete_matshow not same as tutorial

Hi, when I try to run your tutorial to make a segmentation with vgg16, I got the result, it's look well.
But it's a little different with your result image.

This is my result.
image

I'd like to tune the color map(or color bar) as yours.
But I don't know how to do.

Thanks!!

error of imshow in simple_classification_segmentation.ipynb

when running the code to show the resized, cropped, mean-centered input to the network (vgg-16)
plt.imshow( network_input / (network_input.max() - network_input.min()) ),

I got an value error saying "Floating point image RGB values must be in the 0..1 range."

If I resize it as
(network_input - network_input.min()) / (network_input.max() - network_input.min()),
what I get is basically a resized image of the bus with basically the same color, which is expected, but not the same as the result on this notebook, where the major image becomes grey and only the outline of the bus has some color.

Is it cause by the version of matplotlib? I am using 2.1.0 with py3.6

vgg_16/conv1/conv1_1/weights does not exist ?

hello, follow your tutorial encounter a problem, which is , simple_classification_segmentation.ipynb

Below you can see an example of Image Classification. We preprocess the input image by resizing it while preserving the aspect ratio and crop the central part. The size of the crop is equal to the size of images that the network was trained on.

%matplotlib inline

the trace,

ValueError Traceback (most recent call last)
in ()
54 logits, _ = vgg.vgg_16(processed_images,
55 num_classes=1000,
---> 56 is_training=False)
57
58 # In order to get probabilities we apply softmax on the output.

/home/opuser/models/slim/nets/vgg.py in vgg_16(inputs, num_classes, is_training, dropout_keep_prob, spatial_squeeze, scope)
152 with slim.arg_scope([slim.conv2d, slim.fully_connected, slim.max_pool2d],
153 outputs_collections=end_points_collection):
--> 154 net = slim.repeat(inputs, 2, slim.conv2d, 64, [3, 3], scope='conv1')
155 net = slim.max_pool2d(net, [2, 2], scope='pool1')
156 net = slim.repeat(net, 2, slim.conv2d, 128, [3, 3], scope='conv2')

/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/layers/python/layers/layers.pyc in repeat(inputs, repetitions, layer, *args, **kwargs)
958 for i in range(repetitions):
959 kwargs['scope'] = scope + '_' + str(i+1)
--> 960 outputs = layer(outputs, *args, **kwargs)
961 return outputs
962

/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/framework/python/ops/arg_scope.pyc in func_with_args(*args, **kwargs)
169 current_args = current_scope[key_func].copy()
170 current_args.update(kwargs)
--> 171 return func(*args, **current_args)
172 _add_op(func)
173 setattr(func_with_args, '_key_op', _key_op(func))

/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/layers/python/layers/layers.pyc in convolution2d(inputs, num_outputs, kernel_size, stride, padding, rate, activation_fn, normalizer_fn, normalizer_params, weights_initializer, weights_regularizer, biases_initializer, biases_regularizer, reuse, variables_collections, outputs_collections, trainable, scope)
405 regularizer=weights_regularizer,
406 collections=weights_collections,
--> 407 trainable=trainable)
408 if rate > 1:
409 outputs = nn.atrous_conv2d(inputs, weights, rate, padding=padding)

/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/framework/python/ops/arg_scope.pyc in func_with_args(*args, **kwargs)
169 current_args = current_scope[key_func].copy()
170 current_args.update(kwargs)
--> 171 return func(*args, **current_args)
172 _add_op(func)
173 setattr(func_with_args, '_key_op', _key_op(func))

/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/framework/python/ops/variables.pyc in model_variable(name, shape, dtype, initializer, regularizer, trainable, collections, caching_device, device)
264 initializer=initializer, regularizer=regularizer,
265 trainable=trainable, collections=collections,
--> 266 caching_device=caching_device, device=device)
267
268

/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/framework/python/ops/arg_scope.pyc in func_with_args(*args, **kwargs)
169 current_args = current_scope[key_func].copy()
170 current_args.update(kwargs)
--> 171 return func(*args, **current_args)
172 _add_op(func)
173 setattr(func_with_args, '_key_op', _key_op(func))

/usr/local/lib/python2.7/dist-packages/tensorflow/contrib/framework/python/ops/variables.pyc in variable(name, shape, dtype, initializer, regularizer, trainable, collections, caching_device, device)
228 trainable=trainable,
229 collections=collections,
--> 230 caching_device=caching_device)
231
232

/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/variable_scope.pyc in get_variable(name, shape, dtype, initializer, regularizer, trainable, collections, caching_device, partitioner, validate_shape, custom_getter)
828 collections=collections, caching_device=caching_device,
829 partitioner=partitioner, validate_shape=validate_shape,
--> 830 custom_getter=custom_getter)
831
832

/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/variable_scope.pyc in get_variable(self, var_store, name, shape, dtype, initializer, regularizer, trainable, collections, caching_device, partitioner, validate_shape, custom_getter)
671 collections=collections, caching_device=caching_device,
672 partitioner=partitioner, validate_shape=validate_shape,
--> 673 custom_getter=custom_getter)
674
675 def _get_partitioned_variable(

/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/variable_scope.pyc in get_variable(self, name, shape, dtype, initializer, regularizer, reuse, trainable, collections, caching_device, partitioner, validate_shape, custom_getter)
215 reuse=reuse, trainable=trainable, collections=collections,
216 caching_device=caching_device, partitioner=partitioner,
--> 217 validate_shape=validate_shape)
218
219 def _get_partitioned_variable(

/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/variable_scope.pyc in _true_getter(name, shape, dtype, initializer, regularizer, reuse, trainable, collections, caching_device, partitioner, validate_shape)
200 initializer=initializer, regularizer=regularizer, reuse=reuse,
201 trainable=trainable, collections=collections,
--> 202 caching_device=caching_device, validate_shape=validate_shape)
203
204 if custom_getter is not None:

/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/variable_scope.pyc in _get_single_variable(self, name, shape, dtype, initializer, regularizer, reuse, trainable, collections, caching_device, validate_shape)
510 raise ValueError("Variable %s does not exist, or was not created with "
511 "tf.get_variable(). Did you mean to set reuse=None in "
--> 512 "VarScope?" % name)
513 if not shape.is_fully_defined() and not initializing_from_value:
514 raise ValueError("Shape of a new variable (%s) must be fully defined, "

ValueError: Variable vgg_16/conv1/conv1_1/weights does not exist, or was not created with tf.get_variable(). Did you mean to set reuse=None in VarScope?

fully_convolutional_networks running error

Hi,

I clone the notebook files from your git site:
git clone https://github.com/de-code/tensorflow_notes.git

But when I run fully_convolutional_networks.ipynb, there's still an error:

ValueError Traceback (most recent call last)
in ()
47 pred, fcn_16s_variables_mapping = FCN_8s(image_batch_tensor=image_batch_tensor,
48 number_of_classes=number_of_classes,
---> 49 is_training=False)
50
51 # The op for initializing the variables.

/home1/data/xiaoren/tf-image-segmentation/tf_image_segmentation/utils/inference.pyc in new_network_definition(*args, **kwargs)
51 kwargs['image_batch_tensor'] = resized_images_batch
52
---> 53 all_outputs = network_definition(*args, **kwargs)
54
55 all_outputs = list(all_outputs)

/home1/data/xiaoren/tf-image-segmentation/tf_image_segmentation/models/fcn_8s.py in FCN_8s(image_batch_tensor, number_of_classes, is_training)
77 is_training=is_training,
78 spatial_squeeze=False,
---> 79 fc_conv_padding='SAME')
80
81

/home1/data/xiaoren/tf-image-segmentation/models/slim/nets/vgg.py in vgg_16(inputs, num_classes, is_training, dropout_keep_prob, spatial_squeeze, scope, fc_conv_padding)
164 with slim.arg_scope([slim.conv2d, slim.fully_connected, slim.max_pool2d],
165 outputs_collections=end_points_collection):
--> 166 net = slim.repeat(inputs, 2, slim.conv2d, 64, [3, 3], scope='conv1')
167 net = slim.max_pool2d(net, [2, 2], scope='pool1')
168 net = slim.repeat(net, 2, slim.conv2d, 128, [3, 3], scope='conv2')

......
I'm not sure if it because the code below, but I don't know where to download that check point file(model_fcn8s_final.ckpt):

fcn_16s_checkpoint_path = '/home1/data/xiaoren/tf-image-segmentation/ckpt/model_fcn8s_final.ckpt'

I really need your help. Thank you!

BTW, I've clone the tensorflow/models instead of from the author's site, because of version 1.0 problem.

Where is the module nets?

Hi, warmspringwinds,thank you for your share. And there is a problem for me , where i can find the module nets ? For from nets import vgg?

there may have some erros in crf

softmax = final_probabilities.squeeze()
softmax = processed_probabilities.transpose((2, 0, 1))

i think it should be:

processed_probabilities= final_probabilities.squeeze()
softmax = processed_probabilities.transpose((2, 0, 1))
am i right?

ValueError: Variable fcn_8s/vgg_16/conv1/conv1_1/weights already exists, disallowed

Hi, @warmspringwinds ,

I followed the steps from README.md. And start to run the first cell from fully_convolutional_networks.ipynb . However I got the following ValueError, could you suggest me how to fix this error?
(my environment: TF 0.12.1, python 2.7.13)

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-3-4efcd9f3827b> in <module>()
     47 pred, fcn_16s_variables_mapping = FCN_8s(image_batch_tensor=image_batch_tensor,
     48                                           number_of_classes=number_of_classes,
---> 49                                           is_training=False)
     50 
     51 # The op for initializing the variables.

/data/code/Dan_segment/tf-image-segmentation/tf_image_segmentation/utils/inference.pyc in new_network_definition(*args, **kwargs)
     51         kwargs['image_batch_tensor'] = resized_images_batch
     52 
---> 53         all_outputs = network_definition(*args, **kwargs)
     54 
     55         all_outputs = list(all_outputs)

/data/code/Dan_segment/tf-image-segmentation/tf_image_segmentation/models/fcn_8s.pyc in FCN_8s(image_batch_tensor, number_of_classes, is_training)
     77                                                        is_training=is_training,
     78                                                        spatial_squeeze=False,
---> 79                                                        fc_conv_padding='SAME')
     80 
     81 

/data/code/Dan_segment/models/slim/nets/vgg.pyc in vgg_16(inputs, num_classes, is_training, dropout_keep_prob, spatial_squeeze, scope, fc_conv_padding)
    164     with slim.arg_scope([slim.conv2d, slim.fully_connected, slim.max_pool2d],
    165                         outputs_collections=end_points_collection):
--> 166       net = slim.repeat(inputs, 2, slim.conv2d, 64, [3, 3], scope='conv1')
    167       net = slim.max_pool2d(net, [2, 2], scope='pool1')
    168       net = slim.repeat(net, 2, slim.conv2d, 128, [3, 3], scope='conv2')

/root/anaconda2/envs/python_2.7_tf_0.12/lib/python2.7/site-packages/tensorflow/contrib/layers/python/layers/layers.pyc in repeat(inputs, repetitions, layer, *args, **kwargs)
   1668     for i in range(repetitions):
   1669       kwargs['scope'] = scope + '_' + str(i+1)
-> 1670       outputs = layer(outputs, *args, **kwargs)
   1671     return outputs
   1672 

/root/anaconda2/envs/python_2.7_tf_0.12/lib/python2.7/site-packages/tensorflow/contrib/framework/python/ops/arg_scope.pyc in func_with_args(*args, **kwargs)
    175       current_args = current_scope[key_func].copy()
    176       current_args.update(kwargs)
--> 177     return func(*args, **current_args)
    178   _add_op(func)
    179   setattr(func_with_args, '_key_op', _key_op(func))

/root/anaconda2/envs/python_2.7_tf_0.12/lib/python2.7/site-packages/tensorflow/contrib/layers/python/layers/layers.pyc in convolution(inputs, num_outputs, kernel_size, stride, padding, data_format, rate, activation_fn, normalizer_fn, normalizer_params, weights_initializer, weights_regularizer, biases_initializer, biases_regularizer, reuse, variables_collections, outputs_collections, trainable, scope)
    838                                        regularizer=weights_regularizer,
    839                                        collections=weights_collections,
--> 840                                        trainable=trainable)
    841     outputs = nn.convolution(input=inputs,
    842                              filter=weights,

/root/anaconda2/envs/python_2.7_tf_0.12/lib/python2.7/site-packages/tensorflow/contrib/framework/python/ops/arg_scope.pyc in func_with_args(*args, **kwargs)
    175       current_args = current_scope[key_func].copy()
    176       current_args.update(kwargs)
--> 177     return func(*args, **current_args)
    178   _add_op(func)
    179   setattr(func_with_args, '_key_op', _key_op(func))

/root/anaconda2/envs/python_2.7_tf_0.12/lib/python2.7/site-packages/tensorflow/contrib/framework/python/ops/variables.pyc in model_variable(name, shape, dtype, initializer, regularizer, trainable, collections, caching_device, device)
    242                   initializer=initializer, regularizer=regularizer,
    243                   trainable=trainable, collections=collections,
--> 244                   caching_device=caching_device, device=device)
    245 
    246 

/root/anaconda2/envs/python_2.7_tf_0.12/lib/python2.7/site-packages/tensorflow/contrib/framework/python/ops/arg_scope.pyc in func_with_args(*args, **kwargs)
    175       current_args = current_scope[key_func].copy()
    176       current_args.update(kwargs)
--> 177     return func(*args, **current_args)
    178   _add_op(func)
    179   setattr(func_with_args, '_key_op', _key_op(func))

/root/anaconda2/envs/python_2.7_tf_0.12/lib/python2.7/site-packages/tensorflow/contrib/framework/python/ops/variables.pyc in variable(name, shape, dtype, initializer, regularizer, trainable, collections, caching_device, device)
    206                                        trainable=trainable,
    207                                        collections=collections,
--> 208                                        caching_device=caching_device)
    209 
    210 

/root/anaconda2/envs/python_2.7_tf_0.12/lib/python2.7/site-packages/tensorflow/python/ops/variable_scope.pyc in get_variable(name, shape, dtype, initializer, regularizer, trainable, collections, caching_device, partitioner, validate_shape, custom_getter)
   1022       collections=collections, caching_device=caching_device,
   1023       partitioner=partitioner, validate_shape=validate_shape,
-> 1024       custom_getter=custom_getter)
   1025 
   1026 

/root/anaconda2/envs/python_2.7_tf_0.12/lib/python2.7/site-packages/tensorflow/python/ops/variable_scope.pyc in get_variable(self, var_store, name, shape, dtype, initializer, regularizer, trainable, collections, caching_device, partitioner, validate_shape, custom_getter)
    848           collections=collections, caching_device=caching_device,
    849           partitioner=partitioner, validate_shape=validate_shape,
--> 850           custom_getter=custom_getter)
    851 
    852   def _get_partitioned_variable(self,

/root/anaconda2/envs/python_2.7_tf_0.12/lib/python2.7/site-packages/tensorflow/python/ops/variable_scope.pyc in get_variable(self, name, shape, dtype, initializer, regularizer, reuse, trainable, collections, caching_device, partitioner, validate_shape, custom_getter)
    344           reuse=reuse, trainable=trainable, collections=collections,
    345           caching_device=caching_device, partitioner=partitioner,
--> 346           validate_shape=validate_shape)
    347 
    348   def _get_partitioned_variable(

/root/anaconda2/envs/python_2.7_tf_0.12/lib/python2.7/site-packages/tensorflow/python/ops/variable_scope.pyc in _true_getter(name, shape, dtype, initializer, regularizer, reuse, trainable, collections, caching_device, partitioner, validate_shape)
    329           initializer=initializer, regularizer=regularizer, reuse=reuse,
    330           trainable=trainable, collections=collections,
--> 331           caching_device=caching_device, validate_shape=validate_shape)
    332 
    333     if custom_getter is not None:

/root/anaconda2/envs/python_2.7_tf_0.12/lib/python2.7/site-packages/tensorflow/python/ops/variable_scope.pyc in _get_single_variable(self, name, shape, dtype, initializer, regularizer, partition_info, reuse, trainable, collections, caching_device, validate_shape)
    630                          " Did you mean to set reuse=True in VarScope? "
    631                          "Originally defined at:\n\n%s" % (
--> 632                              name, "".join(traceback.format_list(tb))))
    633       found_var = self._vars[name]
    634       if not shape.is_compatible_with(found_var.get_shape()):

ValueError: Variable fcn_8s/vgg_16/conv1/conv1_1/weights already exists, disallowed. Did you mean to set reuse=True in VarScope? Originally defined at:

  File "/root/anaconda2/envs/python_2.7_tf_0.12/lib/python2.7/site-packages/tensorflow/contrib/framework/python/ops/variables.py", line 208, in variable
    caching_device=caching_device)
  File "/root/anaconda2/envs/python_2.7_tf_0.12/lib/python2.7/site-packages/tensorflow/contrib/framework/python/ops/arg_scope.py", line 177, in func_with_args
    return func(*args, **current_args)
  File "/root/anaconda2/envs/python_2.7_tf_0.12/lib/python2.7/site-packages/tensorflow/contrib/framework/python/ops/variables.py", line 244, in model_variable
    caching_device=caching_device, device=device)

NameError: name 'processed_probabilities' is not defined

Hi,
I came across your article about "Image Segmentation with Tensorflow using CNNs and Conditional Random Fields" and I tried to follow him. But in last section (Conditional Random Field post-processing) I have error in line:
softmax = processed_probabilities.transpose((2, 0, 1))
because variable processed_probabilities is nowhere defined. I tried to correct that mistake myself, but I failed.
Could you please help with this error?

NameError: name 'processed_probabilities' is not defined

Thanks you.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.