Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: tensorflow/java-models
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: mnist
Choose a base ref
...
head repository: tensorflow/java-models
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 19 commits
  • 51 files changed
  • 8 contributors

Commits on Apr 7, 2020

  1. Merge pull request #2 from tensorflow/mnist

    Add Mnist examples (Simple and CNN)
    karllessard authored Apr 7, 2020
    Configuration menu
    Copy the full SHA
    834b931 View commit details
    Browse the repository at this point in the history

Commits on May 18, 2020

  1. Configuration menu
    Copy the full SHA
    d91770c View commit details
    Browse the repository at this point in the history
  2. Add missing copyrights

    karllessard committed May 18, 2020
    Configuration menu
    Copy the full SHA
    a9990df View commit details
    Browse the repository at this point in the history

Commits on May 19, 2020

  1. Configuration menu
    Copy the full SHA
    c30c550 View commit details
    Browse the repository at this point in the history

Commits on Jun 18, 2020

  1. Bump guava in /tensorflow-examples-legacy/label_image (#15)

    Bumps [guava](https://github.com/google/guava) from 23.6-jre to 24.1.1-jre.
    - [Release notes](https://github.com/google/guava/releases)
    - [Commits](https://github.com/google/guava/commits)
    
    Signed-off-by: dependabot[bot] <support@github.com>
    
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Jun 18, 2020
    Configuration menu
    Copy the full SHA
    5ff9730 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    5704d97 View commit details
    Browse the repository at this point in the history

Commits on Jul 28, 2020

  1. VGG'11 model on FashionMNIST dataset (#16)

    * Added VGG example on Fashion Mnist Dataset
    * Added licenses
    * Fixed notes and renamed the packages
    * Fixed the package name
    * Fixed the licenses and added citation for FashionMNIST
    zaleslaw authored Jul 28, 2020
    Configuration menu
    Copy the full SHA
    1177e2c View commit details
    Browse the repository at this point in the history

Commits on Oct 10, 2020

  1. Configuration menu
    Copy the full SHA
    c3f6dbf View commit details
    Browse the repository at this point in the history

Commits on Mar 30, 2021

  1. Configuration menu
    Copy the full SHA
    f0452dd View commit details
    Browse the repository at this point in the history
  2. Merge pull request #21 from karllessard/upgrade-0.3.1

    Update examples to TF Java 0.3.1
    Craigacp authored Mar 30, 2021
    Configuration menu
    Copy the full SHA
    2ef1672 View commit details
    Browse the repository at this point in the history
  3. Bump guava in /tensorflow-examples-legacy/label_image

    Bumps [guava](https://github.com/google/guava) from 24.1.1-jre to 29.0-jre.
    - [Release notes](https://github.com/google/guava/releases)
    - [Commits](https://github.com/google/guava/commits)
    
    Signed-off-by: dependabot[bot] <support@github.com>
    dependabot[bot] authored Mar 30, 2021
    Configuration menu
    Copy the full SHA
    32cebae View commit details
    Browse the repository at this point in the history

Commits on Apr 7, 2021

  1. Create FasterRcnnInception.java (#23)

    * Create FasterRcnnInception.java
    
    Sample code to load image and perform Object detection with faster_rcnn/inception_resnet_v2_1024x1024
    
    * Added copyright and markdown file closed tensors plus other tidy up,
    
    Amended file to match requested changes
    
    * Moved to new package, plus clean ups
    
    Changed copyright year, added parameters for input and output images, close tensors, created new runner
    
    * Encapsulated tensors
    
    Encapsulated all tensors and a further tidy up
    pyrator authored Apr 7, 2021
    Configuration menu
    Copy the full SHA
    a9d975b View commit details
    Browse the repository at this point in the history

Commits on Apr 15, 2021

  1. Merge pull request #22 from tensorflow/dependabot/maven/tensorflow-ex…

    …amples-legacy/label_image/com.google.guava-guava-29.0-jre
    
    Bump guava from 24.1.1-jre to 29.0-jre in /tensorflow-examples-legacy/label_image
    mihaimaruseac authored Apr 15, 2021
    Configuration menu
    Copy the full SHA
    e0ffb2c View commit details
    Browse the repository at this point in the history

Commits on Jun 10, 2021

  1. Demonstrates DrawBoundingBoxes, EncodeJpeg and WriteFile (#24)

    * Create FasterRcnnInception.java
    
    Sample code to load image and perform Object detection with faster_rcnn/inception_resnet_v2_1024x1024
    
    * Added copyright and markdown file closed tensors plus other tidy up,
    
    Amended file to match requested changes
    
    * Moved to new package, plus clean ups
    
    Changed copyright year, added parameters for input and output images, close tensors, created new runner
    
    * Encapsulated tensors
    
    Encapsulated all tensors and a further tidy up
    
    * Demonstrates DrawBoundingBoxes, EncodeJpeg and WriteFile
    
    Removes BufferedImage code and uses the DrawBoundingBoxes functionality to add boxes to the image and then converts the Tensor back to a Jpeg and writes the file
    
    * Removed superfluous s.run(tf.init())
    
    Session.run doesn't require additional calls to tf.init. Added latest output from DrawBoundingBoxes and WriteFile
    
    * Fold some operations into a single graph and call it once.
    
    simplified number of session run calls
    
    * Added placeholders for holding boxes and outputImagePath
    
    Feeds boxes and image path to placeholders
    
    * Update FasterRcnnInception.java
    
    Moved s.runner() into try catch
    
    * Update FasterRcnnInception.java
    
    Tidy up outputImage as imageShape has dimensions of Tensor
    
    * Removed outputImage
    
    inputshape is available
    pyrator authored Jun 10, 2021
    Configuration menu
    Copy the full SHA
    0489e6b View commit details
    Browse the repository at this point in the history

Commits on Nov 28, 2021

  1. Adapt to TFJava 0.4.0

    karllessard committed Nov 28, 2021
    Configuration menu
    Copy the full SHA
    ed75c1c View commit details
    Browse the repository at this point in the history

Commits on Oct 11, 2024

  1. 1.0.0 update (#34)

    * Upgrade TFJava to 1.0.0 code base
    
    * Update examples for 1.0.0-rc.2
    karllessard authored Oct 11, 2024
    Configuration menu
    Copy the full SHA
    5a84211 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    f35ffc1 View commit details
    Browse the repository at this point in the history
  3. Update README.md (#35)

    Craigacp authored Oct 11, 2024
    Configuration menu
    Copy the full SHA
    d4c109b View commit details
    Browse the repository at this point in the history

Commits on Feb 5, 2025

  1. #36 - Update faster-rcnn example cli from rc.2-with-dependencies.jar …

    …to rc.2-jar-with-dependencies.jar (#37)
    
    On 2024 Macbook Pro 16 - M4 Max 40 core GPU, 48G ram
    
    I keep forgetting to actually read the instructions....
    
    ```
     1049  git clone git@github.com:ObrienlabsDev/tensorflow-java-models-fork
     1050  cd tensorflow-java-models-fork
     1053  source ~/.bash_profile
     1054  mvn clean install -U
    
    michaelobrien@mbp8 tensorflow-java-models-fork % java --version                                                                                                                                                                    
    java 21.0.5 2024-10-15 LTS
    Java(TM) SE Runtime Environment (build 21.0.5+9-LTS-239)
    Java HotSpot(TM) 64-Bit Server VM (build 21.0.5+9-LTS-239, mixed mode, sharing)
    michaelobrien@mbp8 tensorflow-java-models-fork % java -cp target/tensorflow-examples-1.0.0-tfj-1.0.0-rc.2-with-dependencies.jar org.tensorflow.model.examples.cnn.fastrcnn.FasterRcnnInception testimages/image2.jpg image2rcnn.jpg
    Error: Could not find or load main class org.tensorflow.model.examples.cnn.fastrcnn.FasterRcnnInception
    Caused by: java.lang.ClassNotFoundException: org.tensorflow.model.examples.cnn.fastrcnn.FasterRcnnInception
    michaelobrien@mbp8 tensorflow-java-models-fork % ls target 
    archive-tmp								maven-archiver								tensorflow-examples-1.0.0-tfj-1.0.0-rc.2.jar
    classes									maven-status
    generated-sources							tensorflow-examples-1.0.0-tfj-1.0.0-rc.2-jar-with-dependencies.jar
    michaelobrien@mbp8 tensorflow-java-models-fork % java -cp target/tensorflow-examples-1.0.0-tfj-1.0.0-rc.2-jar-with-dependencies.jar  org.tensorflow.model.examples.cnn.fastrcnn.FasterRcnnInception testimages/image2.jpg image2rcnn.jpg
    
    2025-02-04 13:53:11.667204: I tensorflow/cc/saved_model/reader.cc:83] Reading SavedModel from: models/faster_rcnn_inception_resnet_v2_1024x1024
    2025-02-04 13:53:11.667223: I tensorflow/cc/saved_model/loader.cc:317] SavedModel load for tags { serve }; Status: fail: NOT_FOUND: Could not find SavedModel .pb or .pbtxt at supplied export directory path: models/faster_rcnn_inception_resnet_v2_1024x1024. Check that the directory exists and that you have the right permissions for accessing it.. Took 20 microseconds.
    Exception in thread "main" org.tensorflow.exceptions.TensorFlowException: Could not find SavedModel .pb or .pbtxt at supplied export directory path: models/faster_rcnn_inception_resnet_v2_1024x1024. Check that the directory exists and that you have the right permissions for accessing it.
    	at org.tensorflow.internal.c_api.AbstractTF_Status.throwExceptionIfNotOK(AbstractTF_Status.java:90)
    	at org.tensorflow.SavedModelBundle.load(SavedModelBundle.java:590)
    	at org.tensorflow.SavedModelBundle$Loader.load(SavedModelBundle.java:92)
    	at org.tensorflow.SavedModelBundle.load(SavedModelBundle.java:335)
    	at org.tensorflow.model.examples.cnn.fastrcnn.FasterRcnnInception.main(FasterRcnnInception.java:248)
    ```
    
    download model
    
    https://www.kaggle.com/models/tensorflow/faster-rcnn-inception-resnet-v2/tensorFlow2/1024x1024/1?tfhub-redirect=true
    
    ```
    michaelobrien@mbp8 tensorflow-java-models-fork % mkdir models
    michaelobrien@mbp8 tensorflow-java-models-fork % mkdir models/faster_rcnn_inception_resnet_v2_1024x1024
    michaelobrien@mbp8 tensorflow-java-models-fork % cp ~/Downloads/faster-rcnn-inception-resnet-v2-tensorflow2-1024x1024-v1.tar.gz ~/Downloads/faster-rcnn-inception-resnet-v2-tensorflow2-1024x1024-v1.tar.gz models/faster_rcnn_inception_resnet_v2_1024x1024
    
    michaelobrien@mbp8 tensorflow-java-models-fork % cd models/faster_rcnn_inception_resnet_v2_1024x1024 
    michaelobrien@mbp8 faster_rcnn_inception_resnet_v2_1024x1024 % tar -xvf faster-rcnn-inception-resnet-v2-tensorflow2-1024x1024-v1.tar.gz 
    x saved_model.pb
    x variables/
    x variables/variables.data-00000-of-00001
    x variables/variables.index
    ```
    
    run
    
    ```
    cd ../..
    ichaelobrien@mbp8 tensorflow-java-models-fork % java -cp target/tensorflow-examples-1.0.0-tfj-1.0.0-rc.2-jar-with-dependencies.jar org.tensorflow.model.examples.cnn.fastrcnn.FasterRcnnInception testimages/image2.jpg image2rcnn.jpg
    2025-02-04 14:00:21.687692: I tensorflow/cc/saved_model/reader.cc:83] Reading SavedModel from: models/faster_rcnn_inception_resnet_v2_1024x1024
    2025-02-04 14:00:21.729422: I tensorflow/cc/saved_model/reader.cc:51] Reading meta graph with tags { serve }
    2025-02-04 14:00:21.729439: I tensorflow/cc/saved_model/reader.cc:146] Reading SavedModel debug info (if present) from: models/faster_rcnn_inception_resnet_v2_1024x1024
    2025-02-04 14:00:22.085455: I tensorflow/compiler/mlir/mlir_graph_optimization_pass.cc:388] MLIR V1 optimization pass is not enabled
    2025-02-04 14:00:22.110311: I tensorflow/cc/saved_model/loader.cc:234] Restoring SavedModel bundle.
    2025-02-04 14:00:22.755223: I tensorflow/cc/saved_model/loader.cc:218] Running initialization op on SavedModel bundle at path: models/faster_rcnn_inception_resnet_v2_1024x1024
    2025-02-04 14:00:22.987667: I tensorflow/cc/saved_model/loader.cc:317] SavedModel load for tags { serve }; Status: success: OK. Took 1299976 microseconds.
    2025-02-04 14:00:23.505442: W tensorflow/core/framework/op_kernel.cc:1839] OP_REQUIRES failed at whole_file_read_ops.cc:116 : NOT_FOUND: testimages/image2.jpg; No such file or directory
    2025-02-04 14:00:23.505519: W tensorflow/core/framework/op_kernel.cc:1839] OP_REQUIRES failed at whole_file_read_ops.cc:116 : NOT_FOUND: testimages/image2.jpg; No such file or directory
    2025-02-04 14:00:23.505526: W tensorflow/core/framework/local_rendezvous.cc:404] Local rendezvous is aborting with status: NOT_FOUND: testimages/image2.jpg; No such file or directory
    	 [[{{node ReadFile}}]]
    Exception in thread "main" org.tensorflow.exceptions.TensorFlowException: testimages/image2.jpg; No such file or directory
    	 [[{{node ReadFile}}]]
    	at org.tensorflow.internal.c_api.AbstractTF_Status.throwExceptionIfNotOK(AbstractTF_Status.java:90)
    	at org.tensorflow.Session.run(Session.java:826)
    	at org.tensorflow.Session$Runner.runHelper(Session.java:549)
    	at org.tensorflow.Session$Runner.run(Session.java:476)
    	at org.tensorflow.model.examples.cnn.fastrcnn.FasterRcnnInception.main(FasterRcnnInception.java:265)
    
    ```
    
    add 1+ images to run through the model - this one is of the ocean in SF with some people and a plane - no windsurfers that day
    
    ```
    michaelobrien@mbp8 tensorflow-java-models-fork % mkdir testimages                                                                                                                                                                                                                                                                                                                            
     cp ~/Documents/IMG_4177.jpg testimages 
    
    michaelobrien@mbp8 tensorflow-java-models-fork % java -cp target/tensorflow-examples-1.0.0-tfj-1.0.0-rc.2-jar-with-dependencies.jar org.tensorflow.model.examples.cnn.fastrcnn.FasterRcnnInception testimages/IMG_4177.jpg IMG_4177rcnn.jpg 
    2025-02-04 14:14:46.284124: I tensorflow/cc/saved_model/reader.cc:83] Reading SavedModel from: models/faster_rcnn_inception_resnet_v2_1024x1024
    2025-02-04 14:14:46.326818: I tensorflow/cc/saved_model/reader.cc:51] Reading meta graph with tags { serve }
    2025-02-04 14:14:46.326841: I tensorflow/cc/saved_model/reader.cc:146] Reading SavedModel debug info (if present) from: models/faster_rcnn_inception_resnet_v2_1024x1024
    2025-02-04 14:14:46.685110: I tensorflow/compiler/mlir/mlir_graph_optimization_pass.cc:388] MLIR V1 optimization pass is not enabled
    2025-02-04 14:14:46.710239: I tensorflow/cc/saved_model/loader.cc:234] Restoring SavedModel bundle.
    2025-02-04 14:14:47.361626: I tensorflow/cc/saved_model/loader.cc:218] Running initialization op on SavedModel bundle at path: models/faster_rcnn_inception_resnet_v2_1024x1024
    2025-02-04 14:14:47.602413: I tensorflow/cc/saved_model/loader.cc:317] SavedModel load for tags { serve }; Status: success: OK. Took 1318293 microseconds.
    
    ```
    
    <img width="995" alt="Image" src="https://github.com/user-attachments/assets/b14bf582-447a-4866-a4e5-74773a5d6daf" />
    obriensystems authored Feb 5, 2025
    Configuration menu
    Copy the full SHA
    c7c0e90 View commit details
    Browse the repository at this point in the history
Loading