kandi background
Explore Kits

tensorflow-plot | TensorFlow Matplotlib as TF ops | Machine Learning library

 by   wookayin Python Version: v0.3.2 License: MIT

 by   wookayin Python Version: v0.3.2 License: MIT

Download this library from

kandi X-RAY | tensorflow-plot Summary

tensorflow-plot is a Python library typically used in Artificial Intelligence, Machine Learning, Deep Learning, Tensorflow applications. tensorflow-plot has no bugs, it has no vulnerabilities, it has build file available, it has a Permissive License and it has low support. You can install using 'pip install tensorflow-plot' or download it from GitHub, PyPI.
There are two main ways of using tfplot: (i) Use as TF op, and (ii) Manually add summary protos.
Support
Support
Quality
Quality
Security
Security
License
License
Reuse
Reuse

kandi-support Support

  • tensorflow-plot has a low active ecosystem.
  • It has 288 star(s) with 41 fork(s). There are 14 watchers for this library.
  • It had no major release in the last 12 months.
  • There are 5 open issues and 10 have been closed. On average issues are closed in 79 days. There are no pull requests.
  • It has a neutral sentiment in the developer community.
  • The latest version of tensorflow-plot is v0.3.2
tensorflow-plot Support
Best in #Machine Learning
Average in #Machine Learning
tensorflow-plot Support
Best in #Machine Learning
Average in #Machine Learning

quality kandi Quality

  • tensorflow-plot has 0 bugs and 14 code smells.
tensorflow-plot Quality
Best in #Machine Learning
Average in #Machine Learning
tensorflow-plot Quality
Best in #Machine Learning
Average in #Machine Learning

securitySecurity

  • tensorflow-plot has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
  • tensorflow-plot code analysis shows 0 unresolved vulnerabilities.
  • There are 2 security hotspots that need review.
tensorflow-plot Security
Best in #Machine Learning
Average in #Machine Learning
tensorflow-plot Security
Best in #Machine Learning
Average in #Machine Learning

license License

  • tensorflow-plot is licensed under the MIT License. This license is Permissive.
  • Permissive licenses have the least restrictions, and you can use them in most projects.
tensorflow-plot License
Best in #Machine Learning
Average in #Machine Learning
tensorflow-plot License
Best in #Machine Learning
Average in #Machine Learning

buildReuse

  • tensorflow-plot releases are available to install and integrate.
  • Deployable package is available in PyPI.
  • Build file is available. You can build the component from source.
  • Installation instructions, examples and code snippets are available.
  • tensorflow-plot saves you 471 person hours of effort in developing the same functionality from scratch.
  • It has 1111 lines of code, 85 functions and 16 files.
  • It has high code complexity. Code complexity directly impacts maintainability of the code.
tensorflow-plot Reuse
Best in #Machine Learning
Average in #Machine Learning
tensorflow-plot Reuse
Best in #Machine Learning
Average in #Machine Learning
Top functions reviewed by kandi - BETA

kandi has reviewed tensorflow-plot and discovered the below as its top functions. This is intended to give you an instant insight into tensorflow-plot implemented functionality, and help decide if they suit your requirements.

  • Wraps tf autow autowrap func
    • Creates a matplotlib plot
    • Wrap a summary function
    • Create a matplotlib figure
    • Return the class defining a method
    • Merge a dictionary of keyword arguments
    • Clean up names
  • Runs Twine
    • Return the version string
    • Prints a status message
  • Predict a probability map
    • Plots a probmap of x
  • Returns the version string
    • Make a temporary directory

      Get all kandi verified functions for this library.

      Get all kandi verified functions for this library.

      tensorflow-plot Key Features

      📈 TensorFlow + Matplotlib as TF ops

      Usage: Decorator

      copy iconCopydownload iconDownload
      @tfplot.autowrap(figsize=(2, 2))
      def plot_scatter(x: np.ndarray, y: np.ndarray, *, ax, color='red'):
          ax.scatter(x, y, color=color)
      
      x = tf.constant([1, 2, 3], dtype=tf.float32)     # tf.Tensor
      y = tf.constant([1, 4, 9], dtype=tf.float32)     # tf.Tensor
      plot_op = plot_scatter(x, y)                     # tf.Tensor shape=(?, ?, 4) dtype=uint8

      Usage: Wrap as TF ops

      copy iconCopydownload iconDownload
      def figure_heatmap(heatmap, cmap='jet'):
          # draw a heatmap with a colorbar
          fig, ax = tfplot.subplots(figsize=(4, 3))       # DON'T USE plt.subplots() !!!!
          im = ax.imshow(heatmap, cmap=cmap)
          fig.colorbar(im)
          return fig
      
      heatmap_tensor = ...   # tf.Tensor shape=(16, 16) dtype=float32
      
      # (a) wrap function as a Tensor factory
      plot_op = tfplot.autowrap(figure_heatmap)(heatmap_tensor)      # tf.Tensor shape=(?, ?, 4) dtype=uint8
      
      # (b) direct invocation similar to tf.py_func
      plot_op = tfplot.plot(figure_heatmap, [heatmap_tensor], cmap='jet')
      
      # (c) or just directly add an image summary with the plot
      tfplot.summary.plot("heatmap_summary", figure_heatmap, [heatmap_tensor])

      Usage: Manually add summary protos

      copy iconCopydownload iconDownload
      import tensorboard as tb
      fig, ax = ...
      
      # Get RGB image manually or by executing plot ops.
      embedding_plot = sess.run(plot_op)                 # ndarray [H, W, 3] uint8
      embedding_plot = tfplot.figure_to_array(fig)       # ndarray [H, W, 3] uint8
      
      summary_pb = tb.summary.image_pb('plot_embedding', [embedding_plot])
      summary_writer.write_add_summary(summary_pb, global_step=global_step)

      Installation

      copy iconCopydownload iconDownload
      pip install tensorflow-plot

      Thread-safety issue

      copy iconCopydownload iconDownload
      # DON'T DO LIKE THIS !!!
      def figure_heatmap(heatmap):
          fig = plt.figure()                 # <--- NO!
          plt.imshow(heatmap)
          return fig

      Community Discussions

      Trending Discussions on tensorflow-plot
      • Missing modules and attributes for training in TensorFlow's Object Detection API
      • pip search finds tensorflow, but pip install does not
      Trending Discussions on tensorflow-plot

      QUESTION

      Missing modules and attributes for training in TensorFlow's Object Detection API

      Asked 2020-Feb-08 at 15:12

      I'm currently attempting to train an object detection model. I'm following Gilbert Tanner's tutorial on YouTube. I am running TF version 1.9.0.

      It seems as though I'm missing the necessary modules. When I run the following command:

      python model_main.py --logtostderr --model_dir=training/ --pipeline_config_path=traini
      ng/faster_rcnn_inception_v2_pets.config
      

      I get the following error:

      Traceback (most recent call last):
        File "model_main.py", line 26, in <module>
          from object_detection import model_lib
        File "C:\Users\Admin\Anaconda3\envs\object_detection\lib\site-packages\object_detection-0.1-py3.6.egg\object_detection\model_lib.py", line 28, in <module>
          from object_detection import exporter as exporter_lib
        File "C:\Users\Admin\Anaconda3\envs\object_detection\lib\site-packages\object_detection-0.1-py3.6.egg\object_detection\exporter.py", line 24, in <module>
          from object_detection.builders import model_builder
        File "C:\Users\Admin\Anaconda3\envs\object_detection\lib\site-packages\object_detection-0.1-py3.6.egg\object_detection\builders\model_builder.py", line 35, in <module>
          from object_detection.models import faster_rcnn_inception_resnet_v2_feature_extractor as frcnn_inc_res
        File "C:\Users\Admin\Anaconda3\envs\object_detection\lib\site-packages\object_detection-0.1-py3.6.egg\object_detection\models\faster_rcnn_inception_resnet_v2_feature_extractor
      .py", line 30, in <module>
          from nets import inception_resnet_v2
        File "C:\Users\Admin\Desktop\ObjectDetection\models\research\object_detection\nets\inception_resnet_v2.py", line 375, in <module>
          batch_norm_updates_collections=tf.compat.v1.GraphKeys.UPDATE_OPS,
      AttributeError: module 'tensorflow.compat' has no attribute 'v1'
      

      For some reason, I've had to fix other problems with certain modules not being in the correct place (for instance, the nets module wasn't placed under the models/research/object_detection directory upon installation, it was instead placed under models/research/slim).

      I'm not sure exactly how to fix this issue. I've tried bouncing between different 1.x versions of TensorFlow but each time I am met with similar errors, such as not having the 'v2' attribute.

      I suspect I could be lacking a package that should be installed in my environment, but I'm not sure what it could be. I'm also unsure about why the necessary modules aren't properly installed. Here are all of the packages that are installed in my environment:

      Package Version Lastest Version
      absl-py 0.9.0   0.8.1
      astor   0.8.1   0.8.0
      biwrap  0.1.6   
      bleach  1.5.0   3.1.0
      certifi 2019.11.28  2019.11.28
      gast    0.3.3   0.3.2
      grpcio  1.27.0  1.16.1
      h5py    2.10.0  2.10.0
      html5lib    0.9999999   1.0.1
      keras-applications  1.0.8   1.0.8
      keras-preprocessing 1.1.0   1.1.0
      markdown    3.1.1   3.1.1
      mock    3.0.5   3.0.5
      numpy   1.18.1  1.18.1
      object-detection    0.1 
      pandas  1.0.0   1.0.0
      pillow  7.0.0   7.0.0
      pip 20.0.2  20.0.2
      protobuf    3.11.3  3.11.2
      pycocotools 2.0 
      python  3.6.10  3.8.1
      python-dateutil 2.8.1   2.8.1
      pytz    2019.3  2019.3
      setuptools  39.1.0  45.1.0
      six 1.14.0  1.14.0
      sqlite  3.31.1  3.31.1
      tensorboard 1.9.0   2.0.0
      tensorflow  1.9.0   2.0.0
      tensorflow-estimator    1.13.0  2.0.0
      tensorflow-plot 0.3.0   
      tensorflow-tensorboard  1.5.1   
      termcolor   1.1.0   1.1.0
      vc  14.1    14.1
      vs2015_runtime  14.16.27012 14.16.27012
      werkzeug    0.16.1  0.16.1
      wheel   0.34.2  0.34.2
      wincertstore    0.2 0.2
      

      Am I missing any necessary packages? Any help on this issue is appreciated. Please let me know if I have not included information that would be helpful.

      EDIT: Line 375 in C:\Users\Admin\Desktop\ObjectDetection\models\research\object_detection\nets\inception_resnet_v2.py is bolded below:

      def inception_resnet_v2_arg_scope(
          weight_decay=0.00004,
          batch_norm_decay=0.9997,
          batch_norm_epsilon=0.001,
          activation_fn=tf.nn.relu,
          **batch_norm_updates_collections=tf.compat.v1.GraphKeys.UPDATE_OPS**,
          batch_norm_scale=False):
      

      Here is the link to the video I'm referring to. My problem is occurring when I run the command at 18:01. https://www.youtube.com/watch?v=HjiBbChYRDw I realize the command I provided above is slightly different than the one shown in the video. However, in the written version of the tutorial, Gilbert Tanner has updated the command to the one I provided above.

      Changing all references on tf.compat.v1.GraphKeys to tf.GraphKeys works, but more errors arise:

      AttributeError: module 'tensorflow.compat' has no attribute 'v2'
      

      on this function signature:

      def global_pool(input_tensor, pool_op=tf.compat.v2.nn.avg_pool2d)
      

      When I change it to this:

      def global_pool(input_tensor, pool_op=tf.nn.avg_pool2d)
      

      I get this error:

      AttributeError: module 'tensorflow.nn' has no attribute 'avg_pool2d'
      

      There is no documentation for avg_pool2d for TensorFlow 1.x and there is for TensorFlow 2.x, so I'm not sure why it's in this file if I have TensorFlow 1.9.

      I notice tf.nn has attributes avg_pool and avg_pool3d, however, changing it to these causes a TypeError:

      Traceback (most recent call last):
        File "model_main.py", line 109, in <module>
          tf.app.run()
        File "C:\Users\Admin\Anaconda3\envs\object_detection\lib\site-packages\tensorflow\python\platform\app.py", line 125, in run
          _sys.exit(main(argv))
        File "model_main.py", line 105, in main
          tf.estimator.train_and_evaluate(estimator, train_spec, eval_specs[0])
        File "C:\Users\Admin\Anaconda3\envs\object_detection\lib\site-packages\tensorflow\python\estimator\training.py", line 447, in train_and_evaluate
          return executor.run()
        File "C:\Users\Admin\Anaconda3\envs\object_detection\lib\site-packages\tensorflow\python\estimator\training.py", line 531, in run
          return self.run_local()
        File "C:\Users\Admin\Anaconda3\envs\object_detection\lib\site-packages\tensorflow\python\estimator\training.py", line 669, in run_local
          hooks=train_hooks)
        File "C:\Users\Admin\Anaconda3\envs\object_detection\lib\site-packages\tensorflow\python\estimator\estimator.py", line 366, in train
          loss = self._train_model(input_fn, hooks, saving_listeners)
        File "C:\Users\Admin\Anaconda3\envs\object_detection\lib\site-packages\tensorflow\python\estimator\estimator.py", line 1119, in _train_model
          return self._train_model_default(input_fn, hooks, saving_listeners)
        File "C:\Users\Admin\Anaconda3\envs\object_detection\lib\site-packages\tensorflow\python\estimator\estimator.py", line 1129, in _train_model_default
          input_fn, model_fn_lib.ModeKeys.TRAIN))
        File "C:\Users\Admin\Anaconda3\envs\object_detection\lib\site-packages\tensorflow\python\estimator\estimator.py", line 985, in _get_features_and_labels_from_input_fn
          result = self._call_input_fn(input_fn, mode)
        File "C:\Users\Admin\Anaconda3\envs\object_detection\lib\site-packages\tensorflow\python\estimator\estimator.py", line 1074, in _call_input_fn
          return input_fn(**kwargs)
        File "C:\Users\Admin\Anaconda3\envs\object_detection\lib\site-packages\object_detection-0.1-py3.6.egg\object_detection\inputs.py", line 504, in _train_input_fn
          params=params)
        File "C:\Users\Admin\Anaconda3\envs\object_detection\lib\site-packages\object_detection-0.1-py3.6.egg\object_detection\inputs.py", line 607, in train_input
          batch_size=params['batch_size'] if params else train_config.batch_size)
        File "C:\Users\Admin\Anaconda3\envs\object_detection\lib\site-packages\object_detection-0.1-py3.6.egg\object_detection\builders\dataset_builder.py", line 155, in build
          dataset = data_map_fn(process_fn, num_parallel_calls=num_parallel_calls)
        File "C:\Users\Admin\Anaconda3\envs\object_detection\lib\site-packages\tensorflow\python\data\ops\dataset_ops.py", line 882, in map
          return ParallelMapDataset(self, map_func, num_parallel_calls)
        File "C:\Users\Admin\Anaconda3\envs\object_detection\lib\site-packages\tensorflow\python\data\ops\dataset_ops.py", line 1899, in __init__
          super(ParallelMapDataset, self).__init__(input_dataset, map_func)
        File "C:\Users\Admin\Anaconda3\envs\object_detection\lib\site-packages\tensorflow\python\data\ops\dataset_ops.py", line 1868, in __init__
          self._map_func.add_to_graph(ops.get_default_graph())
        File "C:\Users\Admin\Anaconda3\envs\object_detection\lib\site-packages\tensorflow\python\framework\function.py", line 475, in add_to_graph
          self._create_definition_if_needed()
        File "C:\Users\Admin\Anaconda3\envs\object_detection\lib\site-packages\tensorflow\python\framework\function.py", line 331, in _create_definition_if_needed
          self._create_definition_if_needed_impl()
        File "C:\Users\Admin\Anaconda3\envs\object_detection\lib\site-packages\tensorflow\python\framework\function.py", line 340, in _create_definition_if_needed_impl
          self._capture_by_value, self._caller_device)
        File "C:\Users\Admin\Anaconda3\envs\object_detection\lib\site-packages\tensorflow\python\framework\function.py", line 804, in func_graph_from_py_func
          outputs = func(*func_graph.inputs)
        File "C:\Users\Admin\Anaconda3\envs\object_detection\lib\site-packages\tensorflow\python\data\ops\dataset_ops.py", line 1833, in tf_map_func
          ret = map_func(nested_args)
        File "C:\Users\Admin\Anaconda3\envs\object_detection\lib\site-packages\object_detection-0.1-py3.6.egg\object_detection\builders\dataset_builder.py", line 134, in process_fn
          processed_tensors = decoder.decode(value)
        File "C:\Users\Admin\Anaconda3\envs\object_detection\lib\site-packages\object_detection-0.1-py3.6.egg\object_detection\data_decoders\tf_example_decoder.py", line 388, in decod
      e
          tensors = decoder.decode(serialized_example, items=keys)
        File "C:\Users\Admin\Anaconda3\envs\object_detection\lib\site-packages\tensorflow\contrib\slim\python\slim\data\tfexample_decoder.py", line 520, in decode
          outputs.append(handler.tensors_to_item(keys_to_tensors))
        File "C:\Users\Admin\Anaconda3\envs\object_detection\lib\site-packages\object_detection-0.1-py3.6.egg\object_detection\data_decoders\tf_example_decoder.py", line 129, in tenso
      rs_to_item
          item = self._handler.tensors_to_item(keys_to_tensors)
        File "C:\Users\Admin\Anaconda3\envs\object_detection\lib\site-packages\object_detection-0.1-py3.6.egg\object_detection\data_decoders\tf_example_decoder.py", line 98, in tensor
      s_to_item
          return tf.maximum(self._name_to_id_table.lookup(unmapped_tensor),
        File "C:\Users\Admin\Anaconda3\envs\object_detection\lib\site-packages\tensorflow\python\ops\lookup_ops.py", line 223, in lookup
          (self._key_dtype, keys.dtype))
      TypeError: Signature mismatch. Keys must be dtype <dtype: 'float32'>, got <dtype: 'string'>.
      
      
      

      Here is line 98 in tensors_to_item:

          return tf.maximum(self._name_to_id_table.lookup(unmapped_tensor),
                            self._display_name_to_id_table.lookup(unmapped_tensor))
      

      I'm not sure how to handle this issue and it seems like I shouldn't have changed the function signature. Is having to make this many changes to the modules normal?

      ANSWER

      Answered 2020-Feb-08 at 15:12

      This code tf.compat.v1.GraphKeys.UPDATE_OPS is not available on Tensorflow==1.9.0, this is the same for tf.compat.v2.nn.avg_pool2d.

      To have those features update your version to 1.15 with conda install tensorflow=1.15. That will match the tutorial's version. As obtained from it's repository it uses tensorflow-gpu==1.15.2.

      Source https://stackoverflow.com/questions/60104249

      Community Discussions, Code Snippets contain sources that include Stack Exchange Network

      Vulnerabilities

      No vulnerabilities reported

      Install tensorflow-plot

      To grab the latest development version:.

      Support

      For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .

      DOWNLOAD this Library from

      Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
      over 430 million Knowledge Items
      Find more libraries
      Reuse Solution Kits and Libraries Curated by Popular Use Cases
      Explore Kits

      Save this library and start creating your kit

      Share this Page

      share link
      Reuse Pre-built Kits with tensorflow-plot
      Consider Popular Machine Learning Libraries
      Try Top Libraries by wookayin
      Compare Machine Learning Libraries with Highest Support
      Compare Machine Learning Libraries with Highest Quality
      Compare Machine Learning Libraries with Highest Security
      Compare Machine Learning Libraries with Permissive License
      Compare Machine Learning Libraries with Highest Reuse
      Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from
      over 430 million Knowledge Items
      Find more libraries
      Reuse Solution Kits and Libraries Curated by Popular Use Cases
      Explore Kits

      Save this library and start creating your kit

      • © 2022 Open Weaver Inc.