Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Tensorflow 1 Interface
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Bioimage Analysis
Tensorflow 1 Interface
Commits
db734fb7
Commit
db734fb7
authored
2 years ago
by
carlosuc3m
Browse files
Options
Downloads
Patches
Plain Diff
convert to the original macos configuration
parent
1f5fb48b
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/org/bioimageanalysis/icy/deeplearning/tensorflow/v1/Tensorflow1Interface.java
+10
-10
10 additions, 10 deletions
.../icy/deeplearning/tensorflow/v1/Tensorflow1Interface.java
with
10 additions
and
10 deletions
src/main/java/org/bioimageanalysis/icy/deeplearning/tensorflow/v1/Tensorflow1Interface.java
+
10
−
10
View file @
db734fb7
...
...
@@ -103,7 +103,7 @@ public class Tensorflow1Interface implements DeepLearningEngineInterface
private
static
SavedModelBundle
model
;
private
static
SignatureDef
sig
;
private
boolean
interprocessing
=
tru
e
;
private
boolean
interprocessing
=
fals
e
;
private
String
tmpDir
;
...
...
@@ -111,8 +111,6 @@ public class Tensorflow1Interface implements DeepLearningEngineInterface
public
Tensorflow1Interface
()
throws
IOException
{
// TODO remove tmpDIr
tmpDir
=
getTemporaryDir
();
boolean
isMac
=
PlatformDetection
.
isMacOS
();
boolean
isIntel
=
new
PlatformDetection
().
getArch
().
equals
(
PlatformDetection
.
ARCH_X86_64
);
if
(
isMac
&&
isIntel
)
{
...
...
@@ -124,8 +122,6 @@ public class Tensorflow1Interface implements DeepLearningEngineInterface
public
Tensorflow1Interface
(
boolean
doInterprocessing
)
throws
IOException
{
// TODO remove tmpDIr
tmpDir
=
getTemporaryDir
();
if
(!
doInterprocessing
)
{
interprocessing
=
false
;
}
else
{
...
...
@@ -202,6 +198,7 @@ public class Tensorflow1Interface implements DeepLearningEngineInterface
try
{
sig
=
MetaGraphDef
.
parseFrom
(
byteGraph
).
getSignatureDefOrThrow
(
"serving_default"
);
}
catch
(
InvalidProtocolBufferException
e
)
{
closeModel
();
throw
new
LoadModelException
();
}
}
...
...
@@ -246,22 +243,20 @@ public class Tensorflow1Interface implements DeepLearningEngineInterface
args
.
add
(
this
.
tmpDir
);
for
(
Tensor
tensor
:
inputTensors
)
{
args
.
add
(
tensor
.
getName
()
+
INPUT_FILE_TERMINATION
);}
for
(
Tensor
tensor
:
outputTensors
)
{
args
.
add
(
tensor
.
getName
()
+
OUTPUT_FILE_TERMINATION
);}
/*
try {
main(new String[] {args.get(4), args.get(5), args.get(6), args.get(7)});
} catch (LoadModelException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
} catch (RunModelException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
retrieveInterprocessingTensors(outputTensors);
if (true)
return;
*/
ProcessBuilder
builder
=
new
ProcessBuilder
(
args
);
Process
process
;
try
{
...
...
@@ -270,8 +265,10 @@ public class Tensorflow1Interface implements DeepLearningEngineInterface
throw
new
RunModelException
(
"Error executing the Tensorflow 1 model in"
+
" a separate process. The process was not terminated correctly."
);
}
catch
(
RunModelException
e
)
{
closeModel
();
throw
e
;
}
catch
(
Exception
e
)
{
closeModel
();
throw
new
RunModelException
(
e
.
getCause
().
toString
());
}
...
...
@@ -319,6 +316,7 @@ public class Tensorflow1Interface implements DeepLearningEngineInterface
byteBuffer
.
put
(
MappedFileBuilder
.
createFileHeader
(
tensor
));
MappedFileBuilder
.
build
(
tensor
,
byteBuffer
);
}
catch
(
IOException
e
)
{
closeModel
();
throw
new
RunModelException
(
e
.
getCause
().
toString
());
}
}
...
...
@@ -333,6 +331,7 @@ public class Tensorflow1Interface implements DeepLearningEngineInterface
ByteBuffer
byteBuffer
=
mem
.
duplicate
();
tensor
.
setData
(
MappedBufferToImgLib2
.
build
(
byteBuffer
));
}
catch
(
IOException
e
)
{
closeModel
();
throw
new
RunModelException
(
e
.
getCause
().
toString
());
}
}
...
...
@@ -347,6 +346,7 @@ public class Tensorflow1Interface implements DeepLearningEngineInterface
ByteBuffer
byteBuffer
=
mem
.
duplicate
();
return
MappedBufferToImgLib2
.
buildTensor
(
byteBuffer
);
}
catch
(
IOException
e
)
{
closeModel
();
throw
new
RunModelException
(
e
.
getCause
().
toString
());
}
}
...
...
@@ -356,7 +356,7 @@ public class Tensorflow1Interface implements DeepLearningEngineInterface
* process with the corresponding tensors
* @return
*/
private
List
<
String
>
getProcessCommandsWithoutArgs
(){
private
List
<
String
>
getProcessCommandsWithoutArgs
()
{
String
javaHome
=
System
.
getProperty
(
"java.home"
);
String
javaBin
=
javaHome
+
File
.
separator
+
"bin"
+
File
.
separator
+
"java"
;
String
classpath
=
System
.
getProperty
(
"java.class.path"
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment