Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapt to TFJava 0.5.0 #29

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Adapt to TFJava 0.5.0 #29

wants to merge 8 commits into from

Conversation

Jzow
Copy link

@Jzow Jzow commented Aug 1, 2023

cc #28 article 3

@google-cla
Copy link

google-cla bot commented Aug 1, 2023

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@@ -269,7 +265,9 @@ public static void main(String[] params) {
//The given SavedModel SignatureDef input
feedDict.put("input_tensor", reshapeTensor);
//The given SavedModel MetaGraphDef key
Map<String, Tensor> outputTensorMap = model.function("serving_default").call(feedDict);
Map<String, Tensor> outputTensorMap = new HashMap<>();
model.function("serving_default").call(feedDict);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change means the output of the model is discarded, please revert it.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I roughly understand what you mean, but I'm not sure if this is correct. get(0) will return a tensor.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, @Craigacp Thank you for your timely response. Please help review and raise any issues that need to be revised

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would just be easier to refactor the code to use the result object rather than the Map<String,Tensor>. You're only adding a single output to the map, but then inspecting it for lots of keys that aren't there.

@Jzow Jzow requested a review from Craigacp August 4, 2023 09:10
if (detectionScore > 0.3f) {
boxArray.add(detectionBoxes.get(0, n));
}
Result result = model.function("serving_default").call(feedDict);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This result needs to be in a try with resources so that all the outputs are closed.

@Jzow Jzow requested a review from Craigacp August 4, 2023 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants