Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
imagej-elphel
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Elphel
imagej-elphel
Commits
0378cc52
Commit
0378cc52
authored
Sep 18, 2018
by
Oleg Dzhimiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
changed model tag to 'serve'
parent
b7a74a73
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
4 deletions
+26
-4
TensorflowExamplePlugin.java
src/main/java/TensorflowExamplePlugin.java
+26
-4
No files found.
src/main/java/TensorflowExamplePlugin.java
View file @
0378cc52
...
...
@@ -12,6 +12,7 @@ import org.tensorflow.SavedModelBundle;
import
org.tensorflow.OperationBuilder
;
import
org.tensorflow.Shape
;
import
org.tensorflow.Output
;
import
org.tensorflow.Operation
;
import
java.util.ArrayList
;
import
java.util.Collection
;
...
...
@@ -51,7 +52,9 @@ public class TensorflowExamplePlugin
{
public
final
static
String
EXPORTDIR
=
"/home/oleg/GIT/python3-imagej-tiff/data_sets/tf_data_5x5_main_13_heur/exportdir"
;
public
final
static
String
PB_TAG
=
"model_pb"
;
// tf.saved_model.tag_constants.SERVING = "serve"
public
final
static
String
PB_TAG
=
"serve"
;
public
static
void
run
()
{
...
...
@@ -155,13 +158,31 @@ public class TensorflowExamplePlugin
try
{
//bundle.session().runner().fetch("Disparity_net/stage1done:0").run();
// init variable via constant
Tensor
<
Float
>
t
=
toTensor2DFloat
(
rv_stage1_out
,
tensorsToClose
);
Output
builder_init
=
bundle
.
graph
().
opBuilder
(
"Const"
,
"rv_stage1_out_init"
).
setAttr
(
"dtype"
,
t
.
dataType
()).
setAttr
(
"value"
,
t
).
build
().
output
(
0
);
//
Output builder_init = bundle.graph().opBuilder("Const", "rv_stage1_out_init").setAttr("dtype", t.dataType()).setAttr("value", t).build().output(0);
// variable
OperationBuilder
builder2
=
bundle
.
graph
().
opBuilder
(
"Variable"
,
"rv_stage1_out"
);
builder2
.
addInput
(
builder_init
);
//OperationBuilder builder2 = bundle.graph().opBuilder("Variable", "rv_stage1_out");
//builder2.addInput(builder_init);
//Tensor<Float> tensorVal = t;
//Output oValue = graph.opBuilder("Const", name).setAttr("dtype", tensorVal.dataType()).setAttr("value", tensorVal).build().output(0);
//bundle.graph().opBuilder("Assign", "Assign/rv_stage1_out").setAttr("value", t).build();
Operation
oprahWinfrey
=
bundle
.
graph
().
operation
(
"rv_stage1_out"
);
System
.
out
.
println
(
oprahWinfrey
.
toString
());
System
.
out
.
println
(
oprahWinfrey
.
type
());
//Operation oprahWinfrey2 = bundle.graph().operation("rv_stage1_out_nonexistant");
//System.out.println(oprahWinfrey2.toString());
//System.out.println(oprahWinfrey2.type());
System
.
out
.
println
(
"DONE"
);
//Tensor<Float> t = toTensor2DFloat(rv_stage1_out, tensorsToClose);
//builder.setAttr("dtype", t.dataType()).setAttr("shape",t.shape()).build().output(0);
...
...
@@ -186,6 +207,7 @@ public class TensorflowExamplePlugin
float
[]
resultValues
=
(
float
[])
result
.
copyTo
(
new
float
[
78408
]);
System
.
out
.
println
(
"DONE"
);
}
catch
(
final
IllegalStateException
ise
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment