Skip to content

Benchmarking FasterRcnnInception - #1

Open
karllessard wants to merge 1 commit into
Craigacp:benchmarksfrom
karllessard:benchmarks-adam
Open

karllessard wants to merge 1 commit into
Craigacp:benchmarksfrom
karllessard:benchmarks-adam

Conversation

@karllessard

Copy link
Copy Markdown
Collaborator

Adding skeleton for benchmarking Faster RCNN inception model. Main changes are within the example itself, to separate the pre/post processing from the inference.

@@ -0,0 +1,68 @@
/*
Copyright 2019 The TensorFlow Authors. All Rights Reserved.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

2021?

return Signature.builder()
.input("outputImagePath", outputImagePath)
.input("inputImage", inputImage)
.input("boxes", detectionBoxes)

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Doesn't this need to be connected to the writeFile op in some way?

@karllessard karllessard Jul 30, 2021 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The pre/post processing is executed eagerly, if that's what you are wondering?

@Craigacp Craigacp Jul 30, 2021 •

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Aren't the two concrete functions created as graphs? If so I don't understand how the writefile op is executed as while the graph contains it it's not attached to any output & the buildFromGraph logic traces all the ops between the input and the output.

@karllessard karllessard Jul 30, 2021 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

No, the tf received in parameters is coming from the default eager session. That's the behavior when you are calling a function directly (i.e. function.call(params))

To add it to a graph, I think you need to invoke it via a graph Ops or by passing it in parameter as well, i.e.

Ops tf = Ops.create(graph);
function.call(tf, params); // will add the function to the graph
tf.call(function, params); // idem

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

ConcreteFunction.create(Function<Ops,Signature>) traces the function by adding it to a graph and asking for all the ops between the inputs & outputs, but as there aren't any outputs in the signature I don't think it'll add any ops bar the inputs to the function when it's created.

@karllessard karllessard Jul 30, 2021 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Oh you are right, so I think the dark magic here is that the function will result in a graph but will be executed eagerly, i.e. right away, the default eager session is used for that.

I know it works that way it is because I got the output image written on my side. Now how does it link to writeFile, mmmh... I'm now confused as well. But it works ;)

I can try it out again and let you know

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