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: classicvalues/java-models
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
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.
  • 4 commits
  • 50 files changed
  • 3 contributors

Commits on Oct 11, 2024

  1. 1.0.0 update (tensorflow#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. 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. tensorflow#36 - Update faster-rcnn example cli from rc.2-with-depende…

    …ncies.jar to rc.2-jar-with-dependencies.jar (tensorflow#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