Skip to content

Commit

Permalink
initialize efficientsam if it has been closed
Browse files Browse the repository at this point in the history
  • Loading branch information
carlosuc3m committed Aug 7, 2024
1 parent e048970 commit de7f376
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ public class EfficientSAM implements SAMModel {
*/
public EfficientSAM() throws IOException, RuntimeException, InterruptedException {
this.manager = EfficientSamEnvManager.create();
efficientSamJ = EfficientSamJ.initializeSam(
manager);
efficientSamJ = EfficientSamJ.initializeSam(manager);
}

@Override
Expand Down Expand Up @@ -116,6 +115,8 @@ public boolean isInstalled() {
*/
public void setImage(final RandomAccessibleInterval<?> image, final SAMJLogger useThisLoggerForIt)
throws IOException, InterruptedException, RuntimeException {
if (this.efficientSamJ == null)
efficientSamJ = EfficientSamJ.initializeSam(manager);
try {
this.log = useThisLoggerForIt;
AbstractSamJ.DebugTextPrinter filteringLogger = text -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ public boolean isInstalled() {
*/
public void setImage(final RandomAccessibleInterval<?> image, final SAMJLogger useThisLoggerForIt)
throws IOException, InterruptedException, RuntimeException {
if (this.efficientSamJ == null)
this.efficientSamJ = EfficientViTSamJ.initializeSam("l0", manager);
try {
this.log = useThisLoggerForIt;
AbstractSamJ.DebugTextPrinter filteringLogger = text -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ public boolean isInstalled() {
*/
public void setImage(final RandomAccessibleInterval<?> image, final SAMJLogger useThisLoggerForIt)
throws IOException, InterruptedException, RuntimeException {
if (this.efficientSamJ == null)
this.efficientSamJ = EfficientViTSamJ.initializeSam("l1", manager);
try {
this.log = useThisLoggerForIt;
AbstractSamJ.DebugTextPrinter filteringLogger = text -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ public boolean isInstalled() {
*/
public void setImage(final RandomAccessibleInterval<?> image, final SAMJLogger useThisLoggerForIt)
throws IOException, InterruptedException, RuntimeException {
if (this.efficientSamJ == null)
this.efficientSamJ = EfficientViTSamJ.initializeSam("l2", manager);
try {
this.log = useThisLoggerForIt;
AbstractSamJ.DebugTextPrinter filteringLogger = text -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@ public boolean isInstalled() {
*/
public void setImage(final RandomAccessibleInterval<?> image, final SAMJLogger useThisLoggerForIt)
throws IOException, InterruptedException, RuntimeException {
if (this.efficientSamJ == null)
this.efficientSamJ = EfficientViTSamJ.initializeSam("xl0", manager);
try {
this.log = useThisLoggerForIt;
AbstractSamJ.DebugTextPrinter filteringLogger = text -> {
Expand Down

0 comments on commit de7f376

Please sign in to comment.