#36 - Update faster-rcnn example readme cli from rc.2-with-dependencies.jar to rc.2-jar-with-dependencies.jar#37
Merged
Craigacp merged 2 commits intotensorflow:masterfrom Feb 5, 2025
Conversation
…ncies.jar to rc.2-jar-with-dependencies.jar
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" />
tensorflow#36 - Update faster-rcnn example cli from rc.2-with-dependencies.jar …
This was referenced Feb 4, 2025
Update faster-rcnn example cli from rc.2-with-dependencies.jar to rc.2-jar-with-dependencies.jar
#36
Closed
Craigacp
approved these changes
Feb 5, 2025
Collaborator
|
Thanks for fixing the typo. |
Contributor
Author
|
thank you for the very quick review - TensorFlow team. Looking forward to assisting. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…to rc.2-jar-with-dependencies.jar
On 2024 Macbook Pro 16 - M4 Max 40 core GPU, 48G ram
I keep forgetting to actually read the instructions....
download model
https://www.kaggle.com/models/tensorflow/faster-rcnn-inception-resnet-v2/tensorFlow2/1024x1024/1?tfhub-redirect=true
run
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