Models and examples built with TensorFlow

Overview

Logo

Welcome to the Model Garden for TensorFlow

The TensorFlow Model Garden is a repository with a number of different implementations of state-of-the-art (SOTA) models and modeling solutions for TensorFlow users. We aim to demonstrate the best practices for modeling so that TensorFlow users can take full advantage of TensorFlow for their research and product development.

To improve the transparency and reproducibility of our models, training logs on TensorBoard.dev are also provided for models to the extent possible though not all models are suitable.

Directory Description
official • A collection of example implementations for SOTA models using the latest TensorFlow 2's high-level APIs
• Officially maintained, supported, and kept up to date with the latest TensorFlow 2 APIs by TensorFlow
• Reasonably optimized for fast performance while still being easy to read
research • A collection of research model implementations in TensorFlow 1 or 2 by researchers
• Maintained and supported by researchers
community • A curated list of the GitHub repositories with machine learning models and implementations powered by TensorFlow 2
orbit • A flexible and lightweight library that users can easily use or fork when writing customized training loop code in TensorFlow 2.x. It seamlessly integrates with tf.distribute and supports running on different device types (CPU, GPU, and TPU).

Announcements

Contributions

help wanted:paper implementation

If you want to contribute, please review the contribution guidelines.

License

Apache License 2.0

Citing TensorFlow Model Garden

If you use TensorFlow Model Garden in your research, please cite this repository.

@misc{tensorflowmodelgarden2020,
  author = {Hongkun Yu and Chen Chen and Xianzhi Du and Yeqing Li and
            Abdullah Rashwan and Le Hou and Pengchong Jin and Fan Yang and
            Frederick Liu and Jaeyoun Kim and Jing Li},
  title = {{TensorFlow Model Garden}},
  howpublished = {\url{https://github.com/tensorflow/models}},
  year = {2020}
}
Comments
  • convert TF2 ssd_mobilenet_v2 to tflite

    convert TF2 ssd_mobilenet_v2 to tflite

    Hi,

    I am trying to convert a 'ssd_mobilenet_v2_320x320_coco17_tpu-8' TF2 model to .tflite.

    i use export_tflite_ssd_graph.py for create tflite_graph.pb

    But this either fails to create. I am working in Tensorflow 2.3.0 and Python 3.7.3.

    type:feature models:research 
    opened by SajjadAemmi 144
  • Object Detection API 2.0, error with load checkpoints:  A checkpoint was restored (e.g. tf.train.Checkpoint.restore or tf.keras.Model.load_weights) but not all checkpointed values were used.

    Object Detection API 2.0, error with load checkpoints: A checkpoint was restored (e.g. tf.train.Checkpoint.restore or tf.keras.Model.load_weights) but not all checkpointed values were used.

    Prerequisites

    Please answer the following questions for yourself before submitting an issue.

    • [ ] I am using the latest TensorFlow Model Garden release and TensorFlow 2.
    • [ ] I am reporting the issue to the correct repository. (Model Garden official or research directory)
    • [ ] I checked to make sure that this issue has not already been filed.

    1. The entire URL of the file you are using

    https://github.com/tensorflow/models/tree/master/research/object_detection

    2. Describe the bug

    Thanks for releasing the Object Detection API 2.0. I am trying to build the model on my own dataset. I downloaded the trained file from model zoo CenterNet HourGlass104 512x512. Then changed the configure file and test the code. A bug comes.

    WARNING:tensorflow:Unresolved object in checkpoint: (root).model._feature_extractor._network.hourglass_network.1.inner_block.0.inner_block.0.inner_block.0.inner_block.0.decoder_block.1.conv_block.norm.moving_variance
    W0716 19:56:53.424076 140587994642240 util.py:144] Unresolved object in checkpoint: (root).model._feature_extractor._network.hourglass_network.1.inner_block.0.inner_block.0.inner_block.0.inner_block.0.decoder_block.1.conv_block.norm.moving_variance
    WARNING:tensorflow:Unresolved object in checkpoint: (root).model._feature_extractor._network.hourglass_network.1.inner_block.0.inner_block.0.inner_block.0.inner_block.0.decoder_block.1.skip.conv.kernel
    W0716 19:56:53.424108 140587994642240 util.py:144] Unresolved object in checkpoint: (root).model._feature_extractor._network.hourglass_network.1.inner_block.0.inner_block.0.inner_block.0.inner_block.0.decoder_block.1.skip.conv.kernel
    WARNING:tensorflow:Unresolved object in checkpoint: (root).model._feature_extractor._network.hourglass_network.1.inner_block.0.inner_block.0.inner_block.0.inner_block.0.decoder_block.1.skip.norm.axis
    W0716 19:56:53.424140 140587994642240 util.py:144] Unresolved object in checkpoint: (root).model._feature_extractor._network.hourglass_network.1.inner_block.0.inner_block.0.inner_block.0.inner_block.0.decoder_block.1.skip.norm.axis
    WARNING:tensorflow:Unresolved object in checkpoint: (root).model._feature_extractor._network.hourglass_network.1.inner_block.0.inner_block.0.inner_block.0.inner_block.0.decoder_block.1.skip.norm.gamma
    W0716 19:56:53.424172 140587994642240 util.py:144] Unresolved object in checkpoint: (root).model._feature_extractor._network.hourglass_network.1.inner_block.0.inner_block.0.inner_block.0.inner_block.0.decoder_block.1.skip.norm.gamma
    WARNING:tensorflow:Unresolved object in checkpoint: (root).model._feature_extractor._network.hourglass_network.1.inner_block.0.inner_block.0.inner_block.0.inner_block.0.decoder_block.1.skip.norm.beta
    W0716 19:56:53.424204 140587994642240 util.py:144] Unresolved object in checkpoint: (root).model._feature_extractor._network.hourglass_network.1.inner_block.0.inner_block.0.inner_block.0.inner_block.0.decoder_block.1.skip.norm.beta
    WARNING:tensorflow:Unresolved object in checkpoint: (root).model._feature_extractor._network.hourglass_network.1.inner_block.0.inner_block.0.inner_block.0.inner_block.0.decoder_block.1.skip.norm.moving_mean
    W0716 19:56:53.424236 140587994642240 util.py:144] Unresolved object in checkpoint: (root).model._feature_extractor._network.hourglass_network.1.inner_block.0.inner_block.0.inner_block.0.inner_block.0.decoder_block.1.skip.norm.moving_mean
    WARNING:tensorflow:Unresolved object in checkpoint: (root).model._feature_extractor._network.hourglass_network.1.inner_block.0.inner_block.0.inner_block.0.inner_block.0.decoder_block.1.skip.norm.moving_variance
    W0716 19:56:53.424268 140587994642240 util.py:144] Unresolved object in checkpoint: (root).model._feature_extractor._network.hourglass_network.1.inner_block.0.inner_block.0.inner_block.0.inner_block.0.decoder_block.1.skip.norm.moving_variance
    WARNING:tensorflow:A checkpoint was restored (e.g. tf.train.Checkpoint.restore or tf.keras.Model.load_weights) but not all checkpointed values were used. See above for specific issues. Use expect_partial() on the load status object, e.g. tf.train.Checkpoint.restore(...).expect_partial(), to silence these warnings, or use assert_consumed() to make the check explicit. See https://www.tensorflow.org/guide/checkpoint#loading_mechanics for details.
    W0716 19:56:53.424301 140587994642240 util.py:152] **A checkpoint was restored (e.g. tf.train.Checkpoint.restore or tf.keras.Model.load_weights) but not all checkpointed values were used. See above for specific issues. Use expect_partial() on the load status object, e.g. tf.train.Checkpoint.restore(...).expect_partial(), to silence these warnings, or use assert_consumed() to make the check explicit. See https://www.tensorflow.org/guide/checkpoint#loading_mechanics for details.**
    

    A checkpoint was restored (e.g. tf.train.Checkpoint.restore or tf.keras.Model.load_weights) but not all checkpointed values were used. See above for specific issues. Use expect_partial() on the load status object, e.g. tf.train.Checkpoint.restore(...).expect_partial(), to silence these warnings, or use assert_consumed() to make the check explicit. See https://www.tensorflow.org/guide/checkpoint#loading_mechanics for details.

    I do not know how to resolve this issue!

    6. System information

    • OS Platform and Distribution: Linux Ubuntu 18.04
    • TensorFlow installed from (source or binary): installed as the official guide and no error occurs.
    • TensorFlow version (use command below): tensorflow 2.2.0
    • Python version: 3.6
    • CUDA/cuDNN version: CUDA 10.2, CuDNN 7.6
    • GPU model and memory: 2x 2080 Ti
    type:bug models:research 
    opened by DongChen06 138
  • Pretrained model for img2txt?

    Pretrained model for img2txt?

    Please let us know which model this issue is about (specify the top-level directory)

    models/img2txt

    Can someone release a pre-trained model for the img2txt model trained on COCO? Would be great for someone here who doesn't have the computational resource yet to do a full training run. Thanks!

    opened by ludazhao 114
  • DELF: Training procedure

    DELF: Training procedure

    Are the DELF authors able to give a little more detail about how they train their model? Any insight into things like

    - cross-entropy loss and/or accuracy curves during fine-tuning training and/or attention training
    - number of epochs of training; number of GPUs; wall clock time
    - learning rates; how layers are frozen/unfrozen
    - how/whether hyperparameters were tuned on a validation set
    

    would be super helpful. Any specific pointers to other projects (maybe in this repo?) that used a roughly similar procedure would be helpful as well.

    EDIT: Also, can you verify that both the fine-tuning and attention models were trained on this dataset, rather than the Google-Landmarks dataset introduced in your paper.

    Thanks Ben

    cc @andrefaraujo

    stat:awaiting response 
    opened by bkj 89
  • In object_detection_tutorial

    In object_detection_tutorial


    ImportError Traceback (most recent call last) in () ----> 1 from utils import label_map_util 2 3 from utils import visualization_utils as vis_util

    ~/lab/dl/models/object_detection/utils/label_map_util.py in () 20 import tensorflow as tf 21 from google.protobuf import text_format ---> 22 from object_detection.protos import string_int_label_map_pb2 23 24

    ImportError: cannot import name 'string_int_label_map_pb2'

    opened by yuanzhuohao 82
  • Slow inference speed of object detection models and a hack as solution

    Slow inference speed of object detection models and a hack as solution

    System information

    • What is the top-level directory of the model you are using: models/research/object_detection/
    • Have I written custom code: No custom code for reproducing the bug. I have written custom code for diagnosing.
    • OS Platform and Distribution: Linux Ubuntu 16.04
    • TensorFlow installed from (source or binary): Anaconda conda-forge channel
    • TensorFlow version: b'unknown' 1.4.1 (output from python -c "import tensorflow as tf; print(tf.GIT_VERSION, tf.VERSION)")
    • CUDA/cuDNN version: CUDA 8.0/cuDNN 6.0
    • GPU model and memory: 1 TITAN X (Pascal) 12189MiB
    • Exact command to reproduce: Run the provided object detection demo (ssd_mobilenet_v1_coco_2017_11_17 model) with a small modification in the last cell to record the inference speed:
        i = 0
        for _ in range(10):
          image_path = TEST_IMAGE_PATHS[1]
          i += 1
          image = Image.open(image_path)
          # the array based representation of the image will be used later in order to prepare the
          # result image with boxes and labels on it.
          image_np = load_image_into_numpy_array(image)
          # Expand dimensions since the model expects images to have shape: [1, None, None, 3]
          image_np_expanded = np.expand_dims(image_np, axis=0)
          # Actual detection.
          options = tf.RunOptions(trace_level=tf.RunOptions.FULL_TRACE)
          run_metadata = tf.RunMetadata()
          start_time = time.time()
          (boxes, scores, classes, num) = sess.run(
              [detection_boxes, detection_scores, detection_classes, num_detections],
              feed_dict={image_tensor: image_np_expanded})
          print('Iteration %d: %.3f sec'%(i, time.time()-start_time))
    

    The results show that the inference speed is much shower than the reported inference speed, 30ms, in the model zoo page:

    Iteration 1: 2.212 sec
    Iteration 2: 0.069 sec
    Iteration 3: 0.076 sec
    Iteration 4: 0.068 sec
    Iteration 5: 0.072 sec
    Iteration 6: 0.072 sec
    Iteration 7: 0.071 sec
    Iteration 8: 0.079 sec
    Iteration 9: 0.085 sec
    Iteration 10: 0.071 sec
    

    Describe the problem

    Summary: By directly running the provided object detection demo, the observed inference speed of object detection models in the model zoo is much slower than the reported inference speed. With some hack, a higher inference speed than the reported speed can be achieved. After some diagnostics, it is highly likely that the slow inference speed is caused by:

    • tf.where and other post-processing operations are running anomaly slow on GPU; or
    • The frozen inference graph is lack of the ability to optimize the GPU/CPU assignment.

    proof of the hypothesis: tf.where and other post-processing operations are running anomaly slow on GPU

    By outputting trace file, we can diagnose the running time of each node in details. To output the trace file, modify the last cell of object detection demo as:

    from tensorflow.python.client import timeline
    with detection_graph.as_default():
      with tf.Session(graph=detection_graph) as sess:
        # Definite input and output Tensors for detection_graph
        image_tensor = detection_graph.get_tensor_by_name('image_tensor:0')
        # Each box represents a part of the image where a particular object was detected.
        detection_boxes = detection_graph.get_tensor_by_name('detection_boxes:0')
        # Each score represent how level of confidence for each of the objects.
        # Score is shown on the result image, together with the class label.
        detection_scores = detection_graph.get_tensor_by_name('detection_scores:0')
        detection_classes = detection_graph.get_tensor_by_name('detection_classes:0')
        num_detections = detection_graph.get_tensor_by_name('num_detections:0')
        i = 0
        for _ in range(10):
          image_path = TEST_IMAGE_PATHS[1]
          i += 1
          image = Image.open(image_path)
          # the array based representation of the image will be used later in order to prepare the
          # result image with boxes and labels on it.
          image_np = load_image_into_numpy_array(image)
          # Expand dimensions since the model expects images to have shape: [1, None, None, 3]
          image_np_expanded = np.expand_dims(image_np, axis=0)
          # Actual detection.
          options = tf.RunOptions(trace_level=tf.RunOptions.FULL_TRACE)
          run_metadata = tf.RunMetadata()
          start_time = time.time()   
          (boxes, scores, classes, num) = sess.run(\
          [detection_boxes, detection_scores, detection_classes, num_detections], \
          feed_dict={image_tensor: image_np_expanded}, \
          options=options, run_metadata=run_metadata)    
          print('Iteration %d: %.3f sec'%(i, time.time()-start_time))
          # Visualization of the results of a detection.
          vis_util.visualize_boxes_and_labels_on_image_array(
            image_np,
            np.squeeze(boxes),
            np.squeeze(classes).astype(np.int32),
            np.squeeze(scores),
            category_index,
            use_normalized_coordinates=True,
            line_thickness=8)
            
        plt.figure(figsize=IMAGE_SIZE)
        plt.imshow(image_np)
        
        fetched_timeline = timeline.Timeline(run_metadata.step_stats)
        chrome_trace = fetched_timeline.generate_chrome_trace_format()
        with open('Experiment_1.json' , 'w') as f:
          f.write(chrome_trace)
    

    The output json file has been included in the .zip file in the source code section below. Visualizing the json file in chrome://tracing/ gives:

    experiment1

    The CNN related operations end at ~13ms and the rest post-processing operations take about 133ms. We have noticed that adding the trace function will further slow down the inference speed. But it is shows clearly that the post-processing operations (post CNN) run very slowly on GPU.

    As a comparison, one can run the object detection demo with GPU disabled, and profile the running trace using the same method. To disable GPU, add os.environ['CUDA_VISIBLE_DEVICES'] = '' in the first row of the last cell.

    The output json file has been included in the .zip file in the source code section below. Visualizing this json file in chrome://tracing/ gives:

    experiment_2

    By running everything on CPU, the CNN operations end at roughly 63ms and the rest post-processing operations only takes about 15ms on CPU which is significantly faster than the time they take when running on GPU.

    proof of the hypothesis: The frozen inference graph is lack of the ability to optimized the GPU/CPU assignment

    We add some hack trying to see can we achieve a higher inference speed. The hack is manually assigning the CNN related nodes on GPU and the rest nodes on CPU. The idea is using GPU to accelerate only CNN operations and leave the post-processing operations on CPU.

    The source code has been included in the .zip file in the source code section below.

    With this hack, we are able to observe a higher inference speed than the reported speed.

    Iteration 1: 1.021 sec
    Iteration 2: 0.027 sec
    Iteration 3: 0.026 sec
    Iteration 4: 0.027 sec
    Iteration 5: 0.026 sec
    Iteration 6: 0.026 sec
    Iteration 7: 0.026 sec
    Iteration 8: 0.031 sec
    Iteration 9: 0.031 sec
    Iteration 10: 0.026 sec
    

    To verify the hypothesis, here are some questions we need from the tensorflow team:

    1. Are the numbers of inference speed reported on the detection model zoo page tested on the frozen inference graphs or original graphs?

    2. Are the slow tf.where and other post-processing operations supposed to run on GPU or CPU? Is the slow running speed on GPU normal?

    3. Is there a device assigning function to optimize the GPU/CPU use in the original tensorflow graphs? Is that function missing in the frozen inference graphs?

    Source code / logs

    tensorflowissue.zip

    opened by wkelongws 78
  • ObjectDetection API not suitable for tf 2.0.0-alpha0

    ObjectDetection API not suitable for tf 2.0.0-alpha0

    System information

    • What is the top-level directory of the model you are using: /Appendix/tensorflow_models/research
    • Have I written custom code (as opposed to using a stock example script provided in TensorFlow): Nope
    • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Linux Ubuntu 16.04
    • TensorFlow installed from (source or binary): binary
    • TensorFlow version (use command below): 2.0.0-alpha0, and the models lib clone on Mar 11, 2019
    • Bazel version (if compiling from source):
    • CUDA/cuDNN version: 10.0
    • GPU model and memory: 1050Ti
    • Exact command to reproduce: PIPELINE_CONFIG_PATH='/home/jovyan/Codelab/model/pipeline.config' MODEL_DIR='/home/jovyan/Codelab/data' NUM_TRAIN_STEPS=50000 SAMPLE_1_OF_N_EVAL_EXAMPLES=1 python3 object_detection/model_main.py
      --pipeline_config_path=${PIPELINE_CONFIG_PATH}
      --model_dir=${MODEL_DIR}
      --num_train_steps=${NUM_TRAIN_STEPS}
      --sample_1_of_n_eval_examples=$SAMPLE_1_OF_N_EVAL_EXAMPLES
      --alsologtostderr

    tf_upgrade_v2 --intree . --outtree . --copyotherfiles False

    Describe the problem

    I try to use ObjectDetection API in TensorFlow 2.0.0-alpha0, but the program told me that AttributeError: module 'tensorflow' has no attribute 'contrib', clearly Google has delete the contrlib library. So next step I try to use the tf_upgrade_v2 utility to help me converting existing TensorFlow 1.x Python scripts to TensorFlow 2.0. But finally I failed. Here are the message from terminal.

    Source code / logs

    snipaste20190322_205738

    @wangtz

    models:research 
    opened by theangels 70
  • GPU is detected but training starts on the CPU

    GPU is detected but training starts on the CPU

    Hi,

    I have installed the tensorflow-gpu 1.5 or 1.6.rc0 in accompany with Cuda-9.0 and CuDNN-7.0.5 When I start training using train.py, it detects the GPU, but it starts the training on the CPU and CPU load is 100%. The GPU memory gets filled and its core clocks increases but it does not show any consistent load on the cores.

    name: GeForce GTX 1060 6GB major: 6 minor: 1 memoryClockRate(GHz): 1.759
    pciBusID: 0000:01:00.0
    totalMemory: 6.00GiB freeMemory: 4.97GiB
    2018-02-12 11:23:48.533753: I C:\tf_jenkins\workspace\rel-win\M\windows-gpu\PY\36\tensorflow\core\common_runtime\gpu\gpu_device.cc:1308] Adding visible gpu devices: 0
    2018-02-12 11:23:57.838951: I C:\tf_jenkins\workspace\rel-win\M\windows-gpu\PY\36\tensorflow\core\common_runtime\gpu\gpu_device.cc:989] Creating TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 4742 MB memory) -> physical GPU (device: 0, name: GeForce GTX 1060 6GB, pci bus id: 0000:01:00.0, compute capability: 6.1)
    
    stat:awaiting response type:support 
    opened by MyVanitar 70
  • object_detection/protos/*.proto: No such file or directory

    object_detection/protos/*.proto: No such file or directory

    As mentioned above the error takes place in while executing the command in the windows cmd prompt.

    D:/BB/bin/protoc object_detection/protos/*.proto --python_out=.

    as for the reference in the installation process of object detection in this model.

    in protobuf compilation.

    stat:awaiting response type:bug 
    opened by Hemanth-Mydugolam 61
  • Run object_detection prediction on cloudML

    Run object_detection prediction on cloudML

    With the latest changes for exporting a SavedModel d9d10fbbb938534af72f405983cabb85258ac5f3 I tried to run predictions on Google CloudML. When I uploaded my model here https://console.cloud.google.com/mlengine/models I got the following error Model validation failed: SavedModel must contain exactly one metagraph with tag: serve which I was able to fix here: #1810 After this fix I ran into another error: Model validation failed: Outer dimension for SignatureDef outputs must be unknown, outer dimension of 'detection_scores:0' is 1

    Printing out the detection_signature (https://github.com/tensorflow/models/blob/master/object_detection/exporter.py#L281) it looks like this:

    inputs {
      key: "inputs"
      value {
        name: "ToFloat:0"
        dtype: DT_FLOAT
        tensor_shape {
          dim {
            size: 1
          }
          dim {
            size: -1
          }
          dim {
            size: -1
          }
          dim {
            size: 3
          }
        }
      }
    }
    outputs {
      key: "detection_boxes"
      value {
        name: "detection_boxes:0"
        dtype: DT_FLOAT
        tensor_shape {
          dim {
            size: 1
          }
          dim {
            size: 300
          }
          dim {
            size: 4
          }
        }
      }
    }
    outputs {
      key: "detection_classes"
      value {
        name: "detection_classes:0"
        dtype: DT_FLOAT
        tensor_shape {
          dim {
            size: 1
          }
          dim {
            size: 300
          }
        }
      }
    }
    outputs {
      key: "detection_scores"
      value {
        name: "detection_scores:0"
        dtype: DT_FLOAT
        tensor_shape {
          dim {
            size: 1
          }
          dim {
            size: 300
          }
        }
      }
    }
    outputs {
      key: "num_detections"
      value {
        name: "num_detections:0"
        dtype: DT_FLOAT
        tensor_shape {
          dim {
            size: 1
          }
        }
      }
    }
    method_name: "tensorflow/serving/predict"
    

    I am just getting started with tensorflow... it looks to me like the dimension in the shapes should be somehow removed?

    stat:awaiting model gardener 
    opened by NilsLattek 61
  • exporter_main_v2.py on official TF2 OD checkpoints produces saved_model.pb different than official saved_model.pb

    exporter_main_v2.py on official TF2 OD checkpoints produces saved_model.pb different than official saved_model.pb

    Please make sure that this is a bug. As per our GitHub Policy, we only address code/doc bugs, performance issues, feature requests and build/installation issues on GitHub. tag:bug_template

    System information

    • Have I written custom code (as opposed to using a stock example script provided in TensorFlow): No
    • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Linux Ubuntu 18.04
    • Mobile device (e.g. iPhone 8, Pixel 2, Samsung Galaxy) if the issue happens on mobile device: -
    • TensorFlow installed from (source or binary): pip
    • TensorFlow version (use command below): 2.3.0
    • Python version: 3.6.9
    • Bazel version (if compiling from source): -
    • GCC/Compiler version (if compiling from source): -
    • CUDA/cuDNN version: CUDA 11.4
    • GPU model and memory: GeForce RTX 3090

    I am trying to convert a re-trained TF2 object detection SSD MobilenetV2 model to a proprietary framework. I have successfully re-trained the network and it runs properly. However, I am having trouble with converting the saved_model.pb to the other framework. The conversion script from the SDK I am working with performs optimization on the saved_model.pb, using 'meta_optimizer.cc', which returns an empty graph after running through my re-trained model. I used 'exporter_main_v2.py' to export my re-trained checkpoint to the saved_model.pb which I am having trouble with.

    The issue is not with my training or checkpoints, but with the exporting process from checkpoint to a saved_model.pb using 'exporter_main_v2.py'. I know this because I downloaded the SSD MobilenetV2 model from the TF2 Zoo to test with it. I have no issue converting the official saved_model.pb file found in the official repo, but when I try to convert the official checkpoints found in the repo to a saved_model.pb using 'exporter_main_v2.py', I face the same issue trying to convert the newly produced saved_model.pb file to the proprietary framework. This means that something wrong is happening when executing the 'exporter_main_v2.py' script.

    Describe the expected behavior The exported saved_model.pb file should not be different than the official saved_model.pb file found in the official repo.

    The following is what I get, showing 0 nodes and 0 edges grappler_empty_graph

    Standalone code to reproduce the issue The model I downloaded is: http://download.tensorflow.org/models/object_detection/tf2/20200711/ssd_mobilenet_v2_320x320_coco17_tpu-8.tar.gz

    The command I used to export the official checkpoint to a saved_model.pb is: python ~/models/research/object_detection/exporter_main_v2.py --input_type image_tensor --pipeline_config_path pipeline.config --trained_checkpoint_dir checkpoint/ --output_directory exported_model/

    type:bug models:research:odapi 
    opened by ahmadchalhoub 58
  • occur

    occur "UnicodeDecodeError"

    I tried to move quantize_movinet.py. However, when I try to quantize movinet for int8, such as python quantize_movinet.py --saved_model_dir=${SAVED_MODEL_DIR} --saved_model_with_states_dir=${SAVED_MODEL_WITH_STATES_DIR} --output_dataset_dir=${OUTPUT_DATASET_DIR} --output_tflite=${OUTPUT_TFLITE} --quantization_mode=int8 --save_dataset_to_tfrecords=True

    I get following error UnicodeDecodeError: 'utf-8' codec can't decode byte 0x8e in position 193: invalid start byte

    What does it mean? I guess Kinetics600 dataset doesn't work well. So, I added here in line 86 input_path='C:\\Users\\~~\\kinetics600\\', However it doesn't work. Please tell me how to move "quantize_movinet.py." Thanks.

    OS: Windows Python 3.9

    type:support models:official 
    opened by emi-wada 0
  • numpy.core._exceptions.MemoryError: Unable to allocate 4.69 GiB for an array with shape (102400, 64, 64, 3) and data type float32

    numpy.core._exceptions.MemoryError: Unable to allocate 4.69 GiB for an array with shape (102400, 64, 64, 3) and data type float32

    Prerequisites

    Please answer the following questions for yourself before submitting an issue.

    I am reporting the issue to the correct repository. (Model Garden official or research directory). Yes I checked to make sure that this issue has not already been filed. Yes

    • [ ] I am using the tensorflow == 2.3.0 without gpu support.

    1. The entire URL of the file you are using

    https://gitee.com/cleryer-1/image-denoise-using-wasserstein-gan

    This is my modified version of code: https://drive.google.com/drive/folders/1xdRZ5IOnAx_VyhvBB67x19EoDe6CjHUZ?usp=sharing (i only changed image pathways in config.py )

    2. Describe the bug

    I want to denoise images using GAN. I'm trying to implement same code on my own test and training data which is as follows: (http://data.vision.ee.ethz.ch/cvl/DIV2K/DIV2K_train_LR_bicubic_X2.zip) (http://data.vision.ee.ethz.ch/cvl/DIV2K/DIV2K_valid_LR_bicubic_X2.zip) It gave 2 different errors at different times, these are: 'NoneType' object is not iterable numpy.core._exceptions.MemoryError: Unable to allocate 4.69 GiB for an array with shape (102400, 64, 64, 3) and data type float32.

    I also tried it on Google Colab Pro+ but it gives an same error. At the last line, "train()" line it creates an error. Should i change something on filepaths?

    3. Steps to reproduce

    I followed the link above and reshaped and added noise to my own data(256*256 size) with the help of "python image_operation.py -h" in conda. I also changed the amount of virtual memory but problem still occurs. I only changed path in the config.py file with original work.

    4. Expected behavior

    I expect train.py and test.py to give results.

    5. Additional context

    runfile('C:/Users/eren.alici/Desktop/pythons/train.py', wdir='C:/Users/eren.alici/Desktop/pythons') generating patches done Traceback (most recent call last):

    File "C:\Users\eren.alici\Desktop\pythons\train.py", line 83, in train()

    File "C:\Users\eren.alici\Desktop\pythons\train.py", line 24, in train truth, noise = get_patch(truth, noise)

    File "C:\Users\eren.alici\Desktop\pythons\utils.py", line 198, in get_patch return np.array(out_raw), np.array(out_noise)

    MemoryError: Unable to allocate 4.69 GiB for an array with shape (102400, 64, 64, 3) and data type float32

    6. System information

    • OS Platform and Distribution : Windows 10 64 bit Pro
    • TensorFlow installed from: pip
    • TensorFlow version (use command below): 2.3.0
    • Python version: 3.8.10
    • Bazel version (if compiling from source):
    • GCC/Compiler version (if compiling from source):
    • CUDA/cuDNN version: None
    • GPU model and memory: None

    edit: i tried to train just 20 image and it gives this error this time:

    [C:\Users\asus\AppData\Local\Microsoft\WindowsApps\python3.8.exe C:\Users\asus\PycharmProjects\pythonProject1\train.py 2022-12-31 16:50:37.740732: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'cudart64_101.dll'; dlerror: cudart64_101.dll not found 2022-12-31 16:50:37.743082: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine. generating patches done 2022-12-31 16:51:48.724730: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'nvcuda.dll'; dlerror: nvcuda.dll not found 2022-12-31 16:51:48.727183: W tensorflow/stream_executor/cuda/cuda_driver.cc:312] failed call to cuInit: UNKNOWN ERROR (303) 2022-12-31 16:51:48.851474: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:169] retrieving CUDA diagnostic information for host: DESKTOP-OLN8V00 2022-12-31 16:51:48.851846: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:176] hostname: DESKTOP-OLN8V00 2022-12-31 16:51:48.860257: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN)to use the following CPU instructions in performance-critical operations: AVX2 To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags. 2022-12-31 16:51:48.952904: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x1e5e84fe770 initialized for platform Host (this does not guarantee that XLA will be used). Devices: 2022-12-31 16:51:48.953235: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): Host, Default Version Traceback (most recent call last): File "C:\Users\asus\PycharmProjects\pythonProject1\train.py", line 84, in train() File "C:\Users\asus\PycharmProjects\pythonProject1\train.py", line 45, in train for times in epoch_bar(range(truth.shape[0] // BATCH_SIZE)): File "C:\Users\asus\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\progressbar\progressbar.py", line 150, in next value = next(self.__iterable) TypeError: 'NoneType' object is not an iterator](url)

    edit: i tried to train just 20 image and it gives this error this time:

    C:\Users\asus\AppData\Local\Microsoft\WindowsApps\python3.8.exe C:\Users\asus\PycharmProjects\pythonProject1\train.py 2022-12-31 16:50:37.740732: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'cudart64_101.dll'; dlerror: cudart64_101.dll not found 2022-12-31 16:50:37.743082: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine. generating patches done 2022-12-31 16:51:48.724730: W tensorflow/stream_executor/platform/default/dso_loader.cc:59] Could not load dynamic library 'nvcuda.dll'; dlerror: nvcuda.dll not found 2022-12-31 16:51:48.727183: W tensorflow/stream_executor/cuda/cuda_driver.cc:312] failed call to cuInit: UNKNOWN ERROR (303) 2022-12-31 16:51:48.851474: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:169] retrieving CUDA diagnostic information for host: DESKTOP-OLN8V00 2022-12-31 16:51:48.851846: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:176] hostname: DESKTOP-OLN8V00 2022-12-31 16:51:48.860257: I tensorflow/core/platform/cpu_feature_guard.cc:142] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN)to use the following CPU instructions in performance-critical operations: AVX2 To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags. 2022-12-31 16:51:48.952904: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x1e5e84fe770 initialized for platform Host (this does not guarantee that XLA will be used). Devices: 2022-12-31 16:51:48.953235: I tensorflow/compiler/xla/service/service.cc:176] StreamExecutor device (0): Host, Default Version Traceback (most recent call last): File "C:\Users\asus\PycharmProjects\pythonProject1\train.py", line 84, in train() File "C:\Users\asus\PycharmProjects\pythonProject1\train.py", line 45, in train for times in epoch_bar(range(truth.shape[0] // BATCH_SIZE)): File "C:\Users\asus\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\progressbar\progressbar.py", line 150, in next value = next(self.__iterable) TypeError: 'NoneType' object is not an iterator

    stat:awaiting response type:support 
    opened by 21328739 1
  • Add dev container for DELF project

    Add dev container for DELF project

    Description

    It tries to solve the #10874 issue.

    • Make a dev container for the DELF project.

    Type of change

    • [X] New feature (non-breaking change which adds functionality)
    opened by mirzaim 0
  • Add dev container for DELF project

    Add dev container for DELF project

    The suggestion is for the DELF project. https://github.com/tensorflow/models/tree/master/research/delf

    I had some trouble making the DELF model work. It needs some dependencies and some of them had collisions with other projects. I tried to use install_delf.sh script, but It also returns some errors. It takes some time and effort until I can use the project.

    I think It is a good idea to build a dev container and dockerize the whole project. It's a lot easier for others to use it.

    type:feature models:research 
    opened by mirzaim 0
  • train delf  got the error : Cannot add tensor to the batch: number of elements does not match.

    train delf got the error : Cannot add tensor to the batch: number of elements does not match.

    hi, i am training on my own dataset first i use the build_image_dataset.py to creat tfrecord then i run train.py but i always got this error: tensorflow.python.framework.errors_impl.InvalidArgumentError: Cannot add tensor to the batch: number of elements does not match. Shapes are: [tensor]: [310,310,4], [batch]: [310,310,3]

    310 is the image size of my images.

    can someone give some ideas? thanks very much!

    stat:awaiting response type:support models:research stalled 
    opened by taotaoyuhust 2
Releases(v2.11.0)
  • v2.11.0(Nov 23, 2022)

    This release of the Official Models targets TensorFlow 2.11.0. Note that Research/tutorial/sample models have been removed.

    New features:

    1. MobileNetV2 backbone for Mask RCNN
    2. Panoptic deeplab supported;
    3. freeze_backbone supported, and many bug fixes
    4. FNet and SparseMixer implementations
    5. Move ViT models from projects to vision main backbone folder

    Release branch is: https://github.com/tensorflow/models/tree/r2.11

    Source code(tar.gz)
    Source code(zip)
  • v2.10.1(Nov 17, 2022)

    Fix open cv python 3.10 build issue. A lot of downstream clients need to build with 3.10.

    What's Changed

    • Remove opencv-python-headless strict version requirement by @joezoug in https://github.com/tensorflow/models/pull/10831

    New Contributors

    • @joezoug made their first contribution in https://github.com/tensorflow/models/pull/10831

    Full Changelog: https://github.com/tensorflow/models/compare/v2.10.0...v2.10.1

    Source code(tar.gz)
    Source code(zip)
  • v2.10.0(Sep 19, 2022)

    This release of the Official Models targets TensorFlow 2.10.0. Note that Research/tutorial/sample models have been removed.

    TF versions of requirements have been updated to use the corresponding major version.

    Updates:

    1. MobileNetV2 backbone for Mask RCNN.
    2. Panoptic deeplab supported.
    3. freeze_backbone supported, and many bug fixes.

    Pypi package for 2.10 cut is: https://pypi.org/project/tf-models-official/2.10.0/.

    Source code(tar.gz)
    Source code(zip)
  • v2.7.2(Jul 8, 2022)

    Adds a prefetch_buffer_size option to set the prefetch buffer size for input_reader instead of autotune. This resolves the issue of increasing buffer size until the CPU memory is exhausted.

    Updated pip package: https://pypi.org/project/tf-models-official/2.7.2/

    Source code(tar.gz)
    Source code(zip)
  • v2.9.2(May 20, 2022)

    Fix a few import path and init problems.

    We have the initial support to import the model garden libraries as: import tensorflow_models as tfm tfm.nlp.XXX

    Pypi package for 2.9.2 cut is: https://pypi.org/project/tf-models-official/2.9.2/

    Note: how the symbols are exported is defined by: https://github.com/tensorflow/models/tree/master/tensorflow_models/ folder

    Source code(tar.gz)
    Source code(zip)
  • v2.9.0(May 17, 2022)

    This release of the Official Models targets TensorFlow 2.9.0. Note that Research/tutorial/sample models have been removed.

    TF versions of requirements have been updated to use the corresponding major version.

    Notes: official/vision/beta has been released and moved to official/vision, the beta folder is being deprecated.

    Pypi package for 2.9 cut is: https://pypi.org/project/tf-models-official/2.9.0/

    Source code(tar.gz)
    Source code(zip)
  • v2.8.0(Feb 3, 2022)

    This release of the Official Models targets TensorFlow 2.8.0. Note that Research/tutorial/sample models have been removed.

    TF versions of requirements have been updated to use the corresponding major version.

    Notes: official/vision/image_classification and official/vision/detection has been moved into official/legacy/.

    Source code(tar.gz)
    Source code(zip)
  • v2.7.1(Feb 4, 2022)

  • v2.6.1(Dec 15, 2021)

    Fix vision import that accidentally we used cloud_tpu ops. The vision/beta models were broken.

    https://github.com/tensorflow/models/commit/46bf0651e0f1b70c6a46b7a545b8e730b50d65b1

    Updated pip package: https://pypi.org/project/tf-models-official/2.6.1/

    Source code(tar.gz)
    Source code(zip)
  • v2.7.0(Nov 16, 2021)

    This release of the Official Models targets https://github.com/tensorflow/tensorflow/releases/tag/v2.7.0 Note that Research and Community models have been removed. This release of the Official Models targets TensorFlow 2.7.0.

    Pipy package is available as: https://pypi.org/project/tf-models-official/2.7.0/

    Source code(tar.gz)
    Source code(zip)
  • v2.6.0(Aug 16, 2021)

    This release of the Official Models targets https://github.com/tensorflow/tensorflow/releases/tag/v2.6.0 Note that Research and Community models have been removed. Also TF 2.6 has removed Python 3.6 support. We recommend Python 3.7+.

    New Models

    Computer Vision

    Natural Language Processing

    Pip package: https://pypi.org/project/tf-models-official/2.6.0/

    Source code(tar.gz)
    Source code(zip)
  • v2.5.1(Jul 24, 2021)

    This release of the Official Models targets https://github.com/tensorflow/tensorflow/releases/tag/v2.5.1 Note that Research and Community models have been removed.

    Incremental improvements from v2.5.0:

    • Add ranking models (DLRM) in recommendation
    • Bug fixes
    • Remove google-cloud-bigquery in requirements.txt which causes slow installation problems

    Pip package: https://pypi.org/project/tf-models-official/2.5.1/

    Source code(tar.gz)
    Source code(zip)
  • v2.5.0(May 18, 2021)

    This release of the Official Models targets https://github.com/tensorflow/tensorflow/releases/tag/v2.5.0 Note that Research and Community models have been removed.

    New Models

    Computer Vision

    Natural Language Processing

    Pip package: https://pypi.org/project/tf-models-official/2.5.0/

    Source code(tar.gz)
    Source code(zip)
  • v2.4.0(Dec 21, 2020)

    This release of the Official Models targets https://github.com/tensorflow/tensorflow/releases/tag/v2.4.0 This release of the Official Models targets TensorFlow 2.4.0. Note that Research/community models have been removed.

    Pip package: https://pypi.org/project/tf-models-official/ tf-models-official 2.4.0

    Source code(tar.gz)
    Source code(zip)
  • v2.3.0(Jul 31, 2020)

    This release of the Official Models targets https://github.com/tensorflow/tensorflow/releases/tag/v2.3.0

    Pip package: https://pypi.org/project/tf-models-official/2.3.0/

    Source code(tar.gz)
    Source code(zip)
  • v2.2.1(Jul 10, 2020)

  • v2.2.0(May 7, 2020)

    This release of the Official Models targets TensorFlow 2.2.0. Note that Research models have been removed.

    We have nightly release of TensorFlow Models pip package: https://pypi.org/project/tf-models-nightly The version comes with this release is: https://pypi.org/project/tf-models-official/2.2.0/

    Source code(tar.gz)
    Source code(zip)
  • v2.1.0(Jan 30, 2020)

    This release of the Official Models targets TensorFlow 2.1.0. Note that Research/tutorial/sample models have been removed.

    We do not have an official released pip package yet. We are planing to offer this for developers in coming releases.

    Source code(tar.gz)
    Source code(zip)
  • v2.0(Oct 15, 2019)

  • v1.11(Sep 1, 2018)

  • v1.10.0(Jul 17, 2018)

  • v1.9.0(Jun 1, 2018)

  • v1.8.1(May 1, 2018)

  • v1.8.0(Apr 3, 2018)

  • v1.7.0(Mar 20, 2018)

  • v.1.6.0(Feb 16, 2018)

  • v1.4.0(Jan 25, 2018)

Owner
null
🤗 Transformers: State-of-the-art Machine Learning for Pytorch, TensorFlow, and JAX.

English | 简体中文 | 繁體中文 | 한국어 State-of-the-art Machine Learning for JAX, PyTorch and TensorFlow ?? Transformers provides thousands of pretrained models

Hugging Face 77.1k Dec 31, 2022
BetterMood is an iOS app that uses Tensorflow to recognize user’s emotions

BetterMood is an iOS app that uses Tensorflow to recognize user’s emotions, convert it into categories then send via our api along with the user’s date of birth and name, to end up with a emotion analyse and horoscope prediction.

Yosri 2 Sep 30, 2021
A lightweight library to calculate tensors in Swift, which has similar APIs to TensorFlow's

TensorSwift TensorSwift is a lightweight library to calculate tensors, which has similar APIs to TensorFlow's. TensorSwift is useful to simulate calcu

Qoncept, Inc. 323 Oct 20, 2022
Flutter Piano Audio Detection implemented with Tensorflow Lite Model (Google Magenta)

FlutterPianoAudioDetection Plugin Flutter Piano Audio Detection implemented with Tensorflow Lite Model (Google Magenta) Android Implementation iOS/iPa

WonyJeong 27 Dec 29, 2022
[yolov5] + [ios] + [tensorflow lite]

YOLOv5 - TensorFlow Lite Object Detection iOS Example Application iOS Versions Supported: iOS 12.0 and above. Xcode Version Required: 10.0 and above O

Inpyo Hong 14 Dec 12, 2022
TensorFlow C API Class Wrapper in Server Side Swift.

Perfect TensorFlow 简体中文 This project is an experimental wrapper of TensorFlow C API which enables Machine Learning in Server Side Swift. This package

PerfectlySoft Inc. 169 Dec 11, 2022
Swift for TensorFlow

Swift for TensorFlow (Archived) Swift for TensorFlow was an experiment in the next-generation platform for machine learning, incorporating the latest

null 6.1k Dec 31, 2022
Pose Estimation on iOS with TensorFlow Lite

This project is Pose Estimation on iOS with TensorFlow Lite. If you are interested in iOS + Machine Learning, visit here you can see various DEMOs. 2D

tucan9389 125 Nov 28, 2022
A Swift library for creating and exporting CoreML Models in Swift

SwiftCoreMLTools A Swift Library for creating CoreML models in Swift. Work in progress This library expose a (function builder based) DSL as well as a

Jacopo Mangiavacchi 140 Dec 5, 2022
Largest list of models for Core ML (for iOS 11+)

Since iOS 11, Apple released Core ML framework to help developers integrate machine learning models into applications. The official documentation We'v

Kedan Li 5.6k Jan 3, 2023
This repo contains beginner examples to advanced in swift. Aim to create this for learning native iOS development.

iOS-learning-with-swift-22 This repo contains beginner examples to advanced in swift. Aim to create this for learning native iOS development. Oh, you

Umesh Jangid 0 Jan 9, 2022
Artificial intelligence/machine learning data structures and Swift algorithms for future iOS development. bayes theorem, neural networks, and more AI.

Swift Brain The first neural network / machine learning library written in Swift. This is a project for AI algorithms in Swift for iOS and OS X develo

Vishal 331 Oct 14, 2022
Resource monitor - A flutter plugin for Android and IOS to monitor CPU and RAM usage of device.

resource_monitor A flutter plugin for Android and IOS to monitor CPU and RAM usage of device. TODO Implement Android Side of this plugin. Add listener

Skandar Munir 1 Nov 11, 2022
Accelerated tensor operations and dynamic neural networks based on reverse mode automatic differentiation for every device that can run Swift - from watchOS to Linux

DL4S provides a high-level API for many accelerated operations common in neural networks and deep learning. It furthermore has automatic differentiati

Palle 87 Dec 29, 2022
Matft is Numpy-like library in Swift. Function name and usage is similar to Numpy.

Numpy-like library in swift. (Multi-dimensional Array, ndarray, matrix and vector library)

null 80 Dec 21, 2022
Realtime yoga pose detection and classification plugin for Flutter using MLKit

ML Kit Pose Detection Plugin Flutter plugin for realtime pose detection using MLKit's Blazepose. License Copyright (c) 2021 Souvik Biswas, Bharat Bira

Souvik Biswas 8 May 5, 2022
Sample code for Core ML using ResNet50 provided by Apple and a custom model generated by coremltools.

CoreML-samples This is the sample code for Core ML using ResNet50 provided by Apple. ResNet50 can categorize the input image to 1000 pre-trained categ

Yuta Akizuki 39 Nov 11, 2022
A Swift deep learning library with Accelerate and Metal support.

Serrano Aiming to offering popular and cutting edge techs in deep learning area on iOS devices, Serrano is developed as a tool for developers & resear

pcpLiu 51 Nov 17, 2022
DL4S provides a high-level API for many accelerated operations common in neural networks and deep learning.

DL4S provides a high-level API for many accelerated operations common in neural networks and deep learning. It furthermore has automatic differentiati

DL4S Team 2 Dec 5, 2021