45
45
import io .bioimage .modelrunner .download .FileDownloader ;
46
46
47
47
/*
48
- * Class that is manages the installation of SAM and EfficientSAM together with Python, their corresponding environments
48
+ * Class that is manages the installation of SAM and SAM2 together with Python, their corresponding environments
49
49
* and dependencies
50
50
*
51
51
* @author Carlos Javier Garcia Lopez de Haro
@@ -109,11 +109,11 @@ else if (!PlatformDetection.getArch().equals(PlatformDetection.ARCH_ARM64) && !P
109
109
SAM2_1_BYTE_SIZES_MAP .put ("large" , (long ) 898_083_611 );
110
110
}
111
111
/**
112
- * Name of the environment that contains the code and weigths to run EfficientSAM models
112
+ * Name of the environment that contains the code and weigths to run SAM2 models
113
113
*/
114
114
final static public String SAM2_ENV_NAME = "sam2" ;
115
115
/**
116
- * Name of the folder that contains the code and weigths for EfficientSAM models
116
+ * Name of the folder that contains the code and weigths for SAM2 models
117
117
*/
118
118
final static public String SAM2_NAME = "sam2" ;
119
119
/**
@@ -209,9 +209,9 @@ public String getModelType() {
209
209
}
210
210
211
211
/**
212
- * Check whether the Python environment with the corresponding packages needed to run EfficientSAM
212
+ * Check whether the Python environment with the corresponding packages needed to run SAM2
213
213
* has been installed or not. The environment folder should be named {@value #SAM2_ENV_NAME}
214
- * @return whether the Python environment with the corresponding packages needed to run EfficientSAM
214
+ * @return whether the Python environment with the corresponding packages needed to run SAM2
215
215
* has been installed or not
216
216
*/
217
217
public boolean checkSAMDepsInstalled () {
@@ -231,7 +231,7 @@ public boolean checkSAMDepsInstalled() {
231
231
232
232
/**
233
233
*
234
- * @return whether the weights needed to run EfficientSAM Small (the standard EfficientSAM ) have been
234
+ * @return whether the weights needed to run SAM2 Small (the standard SAM2 ) have been
235
235
* downloaded and installed or not
236
236
*/
237
237
public boolean checkModelWeightsInstalled () {
@@ -245,15 +245,15 @@ public boolean checkModelWeightsInstalled() {
245
245
}
246
246
247
247
/**
248
- * Install the weights of EfficientSAM Small.
248
+ * Install the weights of SAM2 Small.
249
249
* Does not overwrite the weights file if it already exists.
250
250
*/
251
251
public void installModelWeigths () throws IOException , InterruptedException {
252
252
installModelWeigths (false );
253
253
}
254
254
255
255
/**
256
- * Install the weights of EfficientSAM Small.
256
+ * Install the weights of SAM2 Small.
257
257
* @param force
258
258
* whether to overwrite the weights file if it already exists
259
259
* @throws InterruptedException if the download of weights is interrupted
@@ -274,8 +274,8 @@ public void installModelWeigths(boolean force) throws IOException, InterruptedEx
274
274
long size = fd .getOnlineFileSize ();
275
275
Consumer <Double > dConsumer = (d ) -> {
276
276
d = (double ) (Math .round (d * 1000 ) / 10 );
277
- if (d < 0 || d > 100 ) passToConsumer (LocalDateTime .now ().format (DATE_FORMAT ).toString () + " -- EFFICIENTVITSAM WEIGHTS DOWNLOAD: UNKNOWN%" );
278
- else passToConsumer (LocalDateTime .now ().format (DATE_FORMAT ).toString () + " -- EFFICIENTVITSAM WEIGHTS DOWNLOAD: " + d + "%" );
277
+ if (d < 0 || d > 100 ) passToConsumer (LocalDateTime .now ().format (DATE_FORMAT ).toString () + " -- SAM2 WEIGHTS DOWNLOAD: UNKNOWN%" );
278
+ else passToConsumer (LocalDateTime .now ().format (DATE_FORMAT ).toString () + " -- SAM2 WEIGHTS DOWNLOAD: " + d + "%" );
279
279
};
280
280
fd .setPartialProgressConsumer (dConsumer );
281
281
fd .download (parentThread );
@@ -298,7 +298,7 @@ public void installModelWeigths(boolean force) throws IOException, InterruptedEx
298
298
}
299
299
300
300
/**
301
- * Install the Python environment and dependencies required to run an EfficientSAM model.
301
+ * Install the Python environment and dependencies required to run an SAM2 model.
302
302
* If Micromamba is not installed in the path of the {@link Sam2EnvManager} instance, this method
303
303
* installs it.
304
304
*
@@ -313,7 +313,7 @@ public void installSAMDeps() throws IOException, InterruptedException, ArchiveEx
313
313
}
314
314
315
315
/**
316
- * Install the Python environment and dependencies required to run an EfficientSAM model.
316
+ * Install the Python environment and dependencies required to run an SAM2 model.
317
317
* If Micromamba is not installed in the path of the {@link Sam2EnvManager} instance, this method
318
318
* installs it.
319
319
* @param force
@@ -362,8 +362,8 @@ public void installSAMDeps(boolean force) throws IOException, InterruptedExcepti
362
362
}
363
363
364
364
/**
365
- * Install all the requirements to run EfficientSAM . First, checks if micromamba is installed, if not installs it;
366
- * then checks if the Python environment and packages needed to run EfficientSAM are installed and if not installs it
365
+ * Install all the requirements to run SAM2 . First, checks if micromamba is installed, if not installs it;
366
+ * then checks if the Python environment and packages needed to run SAM2 are installed and if not installs it
367
367
* and finally checks whether the weights are installed, and if not installs them too.
368
368
*
369
369
*
@@ -384,7 +384,7 @@ public void installEverything() throws IOException, InterruptedException,
384
384
385
385
/**
386
386
*
387
- * @return the the path to the Python environment needed to run EfficientSAM
387
+ * @return the the path to the Python environment needed to run SAM2
388
388
*/
389
389
public String getModelEnv () {
390
390
File file = Paths .get (path , "envs" , SAM2_ENV_NAME ).toFile ();
@@ -394,7 +394,7 @@ public String getModelEnv() {
394
394
395
395
/**
396
396
*
397
- * @return the official name of the EfficientSAM Small weights
397
+ * @return the official name of the SAM2 Small weights
398
398
*/
399
399
public String getModelWeigthsName () {
400
400
try {
0 commit comments