File tree Expand file tree Collapse file tree 9 files changed +182
-7
lines changed
src/main/java/ai/nets/samj/communication/model Expand file tree Collapse file tree 9 files changed +182
-7
lines changed Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ public class EfficientSAM extends SAMModel {
4949 */
5050 public static final String INPUT_IMAGE_AXES = "xyc" ;
5151
52-
52+
5353
5454 /**
5555 * Create an instance of the model that loads the model and encodes an image
@@ -67,6 +67,22 @@ public EfficientSAM() {
6767 this .manager = EfficientSamEnvManager .create ();
6868 }
6969
70+ /**
71+ * Create an instance of the model that loads the model and encodes an image
72+ */
73+ public EfficientSAM (EfficientSamEnvManager manager ) {
74+ this .isHeavy = true ;
75+ this .fullName = "EfficientSAM: Leveraged Masked Image Pretraining for Efficient Segment Anything" ;
76+ this .githubLink = "https://github.com/yformer/EfficientSAM" ;
77+ this .paperLink = "https://arxiv.org/pdf/2312.00863.pdf" ;
78+ this .githubName = "yformer/EfficientSAM" ;
79+ this .paperName = "EfficientSAM: Leveraged Masked Image Pretraining for Efficient Segment" ;
80+ this .speedRank = 5 ;
81+ this .performanceRank = 2 ;
82+ this .size = 105.7 ;
83+ this .manager = manager ;
84+ }
85+
7086 @ Override
7187 /**
7288 * {@inheritDoc}
Original file line number Diff line number Diff line change @@ -49,6 +49,8 @@ public class EfficientViTSAML0 extends SAMModel {
4949 * Axes order required for the input image by the model
5050 */
5151 public static final String INPUT_IMAGE_AXES = "xyc" ;
52+
53+ private static final String ID = "l0" ;
5254
5355
5456
@@ -65,7 +67,25 @@ public EfficientViTSAML0() {
6567 this .speedRank = 3 ;
6668 this .performanceRank = 3 ;
6769 this .size = 139.4 ;
68- this .manager = EfficientViTSamEnvManager .create (EfficientViTSamEnvManager .DEFAULT_DIR , "l0" );
70+ this .manager = EfficientViTSamEnvManager .create (EfficientViTSamEnvManager .DEFAULT_DIR , ID );
71+ }
72+
73+ /**
74+ * Create an instance of the model that loads the model and encodes an image
75+ */
76+ public EfficientViTSAML0 (EfficientViTSamEnvManager manager ) {
77+ this .isHeavy = false ;
78+ this .fullName = "EfficientViT-SAM smallest version (L0)" ;
79+ this .githubLink = "https://github.com/mit-han-lab/efficientvit" ;
80+ this .githubName = "mit-han-lab/efficientvit" ;
81+ this .paperName = "EfficientViT-SAM: Accelerated Segment Anything Model Without Performance Loss" ;
82+ this .paperLink = "https://arxiv.org/pdf/2402.05008.pdf" ;
83+ this .speedRank = 3 ;
84+ this .performanceRank = 3 ;
85+ this .size = 139.4 ;
86+ if (!manager .getModelType ().equals (ID ))
87+ throw new IllegalArgumentException ("The model type should be: " + ID + " vs manager model type: " + manager .getModelType ());
88+ this .manager = manager ;
6989 }
7090
7191 @ Override
Original file line number Diff line number Diff line change @@ -47,7 +47,9 @@ public class EfficientViTSAML1 extends SAMModel {
4747 /**
4848 * Axes order required for the input image by the model
4949 */
50- public static final String INPUT_IMAGE_AXES = "xyc" ;
50+ public static final String INPUT_IMAGE_AXES = "xyc" ;
51+
52+ private static final String ID = "l1" ;
5153
5254
5355 /**
@@ -63,7 +65,25 @@ public EfficientViTSAML1() {
6365 this .speedRank = 3 ;
6466 this .performanceRank = 3 ;
6567 this .size = 190.9 ;
66- this .manager = EfficientViTSamEnvManager .create (EfficientViTSamEnvManager .DEFAULT_DIR , "l1" );
68+ this .manager = EfficientViTSamEnvManager .create (EfficientViTSamEnvManager .DEFAULT_DIR , ID );
69+ }
70+
71+ /**
72+ * Create an instance of the model that loads the model and encodes an image
73+ */
74+ public EfficientViTSAML1 (EfficientViTSamEnvManager manager ) {
75+ this .isHeavy = false ;
76+ this .fullName = "EfficientViT-SAM smallest version (L1)" ;
77+ this .githubLink = "https://github.com/mit-han-lab/efficientvit" ;
78+ this .githubName = "mit-han-lab/efficientvit" ;
79+ this .paperName = "EfficientViT-SAM: Accelerated Segment Anything Model Without Performance Loss" ;
80+ this .paperLink = "https://arxiv.org/pdf/2402.05008.pdf" ;
81+ this .speedRank = 3 ;
82+ this .performanceRank = 3 ;
83+ this .size = 190.9 ;
84+ if (!manager .getModelType ().equals (ID ))
85+ throw new IllegalArgumentException ("The model type should be: " + ID + " vs manager model type: " + manager .getModelType ());
86+ this .manager = manager ;
6787 }
6888
6989 @ Override
Original file line number Diff line number Diff line change @@ -48,6 +48,8 @@ public class EfficientViTSAML2 extends SAMModel {
4848 * Axes order required for the input image by the model
4949 */
5050 public static final String INPUT_IMAGE_AXES = "xyc" ;
51+
52+ private static final String ID = "l2" ;
5153
5254
5355 /**
@@ -63,7 +65,25 @@ public EfficientViTSAML2() {
6365 this .speedRank = 1 ;
6466 this .performanceRank = 5 ;
6567 this .size = 245.7 ;
66- this .manager = EfficientViTSamEnvManager .create (EfficientViTSamEnvManager .DEFAULT_DIR , "l2" );
68+ this .manager = EfficientViTSamEnvManager .create (EfficientViTSamEnvManager .DEFAULT_DIR , ID );
69+ }
70+
71+ /**
72+ * Create an instance of the model that loads the model and encodes an image
73+ */
74+ public EfficientViTSAML2 (EfficientViTSamEnvManager manager ) {
75+ this .isHeavy = false ;
76+ this .fullName = "EfficientViT-SAM smallest version (L2)" ;
77+ this .githubLink = "https://github.com/mit-han-lab/efficientvit" ;
78+ this .githubName = "mit-han-lab/efficientvit" ;
79+ this .paperName = "EfficientViT-SAM: Accelerated Segment Anything Model Without Performance Loss" ;
80+ this .paperLink = "https://arxiv.org/pdf/2402.05008.pdf" ;
81+ this .speedRank = 1 ;
82+ this .performanceRank = 5 ;
83+ this .size = 245.7 ;
84+ if (!manager .getModelType ().equals (ID ))
85+ throw new IllegalArgumentException ("The model type should be: " + ID + " vs manager model type: " + manager .getModelType ());
86+ this .manager = manager ;
6787 }
6888
6989 @ Override
Original file line number Diff line number Diff line change @@ -48,6 +48,8 @@ public class EfficientViTSAMXL0 extends SAMModel {
4848 * Axes order required for the input image by the model
4949 */
5050 public static final String INPUT_IMAGE_AXES = "xyc" ;
51+
52+ private static final String ID = "xl0" ;
5153
5254 /**
5355 * Create an instance of the model that loads the model and encodes an image
@@ -62,7 +64,25 @@ public EfficientViTSAMXL0() {
6264 this .speedRank = 3 ;
6365 this .performanceRank = 3 ;
6466 this .size = 468.2 ;
65- this .manager = EfficientViTSamEnvManager .create (EfficientViTSamEnvManager .DEFAULT_DIR , "xl0" );
67+ this .manager = EfficientViTSamEnvManager .create (EfficientViTSamEnvManager .DEFAULT_DIR , ID );
68+ }
69+
70+ /**
71+ * Create an instance of the model that loads the model and encodes an image
72+ */
73+ public EfficientViTSAMXL0 (EfficientViTSamEnvManager manager ) {
74+ this .isHeavy = false ;
75+ this .fullName = "EfficientViT-SAM smallest version (XL0)" ;
76+ this .githubLink = "https://github.com/mit-han-lab/efficientvit" ;
77+ this .githubName = "mit-han-lab/efficientvit" ;
78+ this .paperName = "EfficientViT-SAM: Accelerated Segment Anything Model Without Performance Loss" ;
79+ this .paperLink = "https://arxiv.org/pdf/2402.05008.pdf" ;
80+ this .speedRank = 3 ;
81+ this .performanceRank = 3 ;
82+ this .size = 468.2 ;
83+ if (!manager .getModelType ().equals (ID ))
84+ throw new IllegalArgumentException ("The model type should be: " + ID + " vs manager model type: " + manager .getModelType ());
85+ this .manager = manager ;
6686 }
6787
6888 @ Override
Original file line number Diff line number Diff line change @@ -49,6 +49,8 @@ public class EfficientViTSAMXL1 extends SAMModel {
4949 * Axes order required for the input image by the model
5050 */
5151 public static final String INPUT_IMAGE_AXES = "xyc" ;
52+
53+ private static final String ID = "xl1" ;
5254
5355
5456 /**
@@ -66,6 +68,24 @@ public EfficientViTSAMXL1() {
6668 this .size = 814 ;
6769 this .manager = EfficientViTSamEnvManager .create (EfficientViTSamEnvManager .DEFAULT_DIR , "xl1" );
6870 }
71+
72+ /**
73+ * Create an instance of the model that loads the model and encodes an image
74+ */
75+ public EfficientViTSAMXL1 (EfficientViTSamEnvManager manager ) {
76+ this .isHeavy = false ;
77+ this .fullName = "EfficientViT-SAM smallest version (XL1)" ;
78+ this .githubLink = "https://github.com/mit-han-lab/efficientvit" ;
79+ this .githubName = "mit-han-lab/efficientvit" ;
80+ this .paperName = "EfficientViT-SAM: Accelerated Segment Anything Model Without Performance Loss" ;
81+ this .paperLink = "https://arxiv.org/pdf/2402.05008.pdf" ;
82+ this .speedRank = 3 ;
83+ this .performanceRank = 3 ;
84+ this .size = 814 ;
85+ if (!manager .getModelType ().equals (ID ))
86+ throw new IllegalArgumentException ("The model type should be: " + ID + " vs manager model type: " + manager .getModelType ());
87+ this .manager = manager ;
88+ }
6989
7090 @ Override
7191 /**
Original file line number Diff line number Diff line change @@ -69,6 +69,26 @@ public SAM2Large() {
6969 this .size = Math .round (10 * Sam2EnvManager .SAM2_BYTE_SIZES_MAP .get (ID ) / ((double ) ( 1024 * 1024 ))) / 10.0 ;
7070 this .manager = Sam2EnvManager .create (Sam2EnvManager .DEFAULT_DIR , ID );
7171 }
72+
73+
74+ /**
75+ * Create an instance of the model that loads the model and encodes an image
76+ */
77+ public SAM2Large (Sam2EnvManager manager ) {
78+ this .isHeavy = true ;
79+ this .fullName = "SAM-2: Segment Anything Model 2 (Large)" ;
80+ this .githubLink = "https://github.com/facebookresearch/segment-anything-2" ;
81+ this .paperLink = "https://ai.meta.com/research/publications/sam-2-segment-anything-in-images-and-videos/" ;
82+ this .githubName = "facebookresearch/segment-anything-2" ;
83+ this .paperName = "SAM 2: Segment Anything in Images and Videos" ;
84+ this .speedRank = 4 ;
85+ this .performanceRank = 1 ;
86+ //this.size = Math.round(10 * Sam2EnvManager.SAM2_1_BYTE_SIZES_MAP.get(ID) / ((double) ( 1024 * 1024))) / 10.0;
87+ this .size = Math .round (10 * Sam2EnvManager .SAM2_BYTE_SIZES_MAP .get (ID ) / ((double ) ( 1024 * 1024 ))) / 10.0 ;
88+ if (!manager .getModelType ().equals (ID ))
89+ throw new IllegalArgumentException ("The model type should be: " + ID + " vs manager model type: " + manager .getModelType ());
90+ this .manager = manager ;
91+ }
7292
7393 @ Override
7494 /**
Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ public class SAM2Small extends SAMModel {
5050 public static final String INPUT_IMAGE_AXES = "xyc" ;
5151
5252 private static String ID = "small" ;
53-
53+
5454
5555 /**
5656 * Create an instance of the model that loads the model and encodes an image
@@ -68,6 +68,25 @@ public SAM2Small() {
6868 this .size = Math .round (10 * Sam2EnvManager .SAM2_BYTE_SIZES_MAP .get (ID ) / ((double ) ( 1024 * 1024 ))) / 10.0 ;
6969 this .manager = Sam2EnvManager .create (Sam2EnvManager .DEFAULT_DIR , ID );
7070 }
71+
72+ /**
73+ * Create an instance of the model that loads the model and encodes an image
74+ */
75+ public SAM2Small (Sam2EnvManager manager ) {
76+ this .isHeavy = true ;
77+ this .fullName = "SAM-2: Segment Anything Model 2 (Small)" ;
78+ this .githubLink = "https://github.com/facebookresearch/segment-anything-2" ;
79+ this .paperLink = "https://ai.meta.com/research/publications/sam-2-segment-anything-in-images-and-videos/" ;
80+ this .githubName = "facebookresearch/segment-anything-2" ;
81+ this .paperName = "SAM 2: Segment Anything in Images and Videos" ;
82+ this .speedRank = 3 ;
83+ this .performanceRank = 3 ;
84+ //this.size = Math.round(10 * Sam2EnvManager.SAM2_1_BYTE_SIZES_MAP.get(ID) / ((double) ( 1024 * 1024))) / 10.0;
85+ this .size = Math .round (10 * Sam2EnvManager .SAM2_BYTE_SIZES_MAP .get (ID ) / ((double ) ( 1024 * 1024 ))) / 10.0 ;
86+ if (!manager .getModelType ().equals (ID ))
87+ throw new IllegalArgumentException ("The model type should be: " + ID + " vs manager model type: " + manager .getModelType ());
88+ this .manager = manager ;
89+ }
7190
7291 @ Override
7392 /**
Original file line number Diff line number Diff line change @@ -68,6 +68,26 @@ public SAM2Tiny() {
6868 this .size = Math .round (10 * Sam2EnvManager .SAM2_BYTE_SIZES_MAP .get (ID ) / ((double ) ( 1024 * 1024 ))) / 10.0 ;
6969 this .manager = Sam2EnvManager .create (Sam2EnvManager .DEFAULT_DIR , ID );
7070 }
71+
72+
73+ /**
74+ * Create an instance of the model that loads the model and encodes an image
75+ */
76+ public SAM2Tiny (Sam2EnvManager manager ) {
77+ this .isHeavy = false ;
78+ this .fullName = "SAM-2: Segment Anything Model 2 (Tiny)" ;
79+ this .githubLink = "https://github.com/facebookresearch/segment-anything-2" ;
80+ this .paperLink = "https://ai.meta.com/research/publications/sam-2-segment-anything-in-images-and-videos/" ;
81+ this .githubName = "facebookresearch/segment-anything-2" ;
82+ this .paperName = "SAM 2: Segment Anything in Images and Videos" ;
83+ this .speedRank = 2 ;
84+ this .performanceRank = 4 ;
85+ //this.size = Math.round(10 * Sam2EnvManager.SAM2_1_BYTE_SIZES_MAP.get(ID) / ((double) ( 1024 * 1024))) / 10.0;
86+ this .size = Math .round (10 * Sam2EnvManager .SAM2_BYTE_SIZES_MAP .get (ID ) / ((double ) ( 1024 * 1024 ))) / 10.0 ;
87+ if (!manager .getModelType ().equals (ID ))
88+ throw new IllegalArgumentException ("The model type should be: " + ID + " vs manager model type: " + manager .getModelType ());
89+ this .manager = manager ;
90+ }
7191
7292 @ Override
7393 /**
You can’t perform that action at this time.
0 commit comments