File tree 9 files changed +182
-7
lines changed
src/main/java/ai/nets/samj/communication/model
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 {
49
49
*/
50
50
public static final String INPUT_IMAGE_AXES = "xyc" ;
51
51
52
-
52
+
53
53
54
54
/**
55
55
* Create an instance of the model that loads the model and encodes an image
@@ -67,6 +67,22 @@ public EfficientSAM() {
67
67
this .manager = EfficientSamEnvManager .create ();
68
68
}
69
69
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
+
70
86
@ Override
71
87
/**
72
88
* {@inheritDoc}
Original file line number Diff line number Diff line change @@ -49,6 +49,8 @@ public class EfficientViTSAML0 extends SAMModel {
49
49
* Axes order required for the input image by the model
50
50
*/
51
51
public static final String INPUT_IMAGE_AXES = "xyc" ;
52
+
53
+ private static final String ID = "l0" ;
52
54
53
55
54
56
@@ -65,7 +67,25 @@ public EfficientViTSAML0() {
65
67
this .speedRank = 3 ;
66
68
this .performanceRank = 3 ;
67
69
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 ;
69
89
}
70
90
71
91
@ Override
Original file line number Diff line number Diff line change @@ -47,7 +47,9 @@ public class EfficientViTSAML1 extends SAMModel {
47
47
/**
48
48
* Axes order required for the input image by the model
49
49
*/
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" ;
51
53
52
54
53
55
/**
@@ -63,7 +65,25 @@ public EfficientViTSAML1() {
63
65
this .speedRank = 3 ;
64
66
this .performanceRank = 3 ;
65
67
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 ;
67
87
}
68
88
69
89
@ Override
Original file line number Diff line number Diff line change @@ -48,6 +48,8 @@ public class EfficientViTSAML2 extends SAMModel {
48
48
* Axes order required for the input image by the model
49
49
*/
50
50
public static final String INPUT_IMAGE_AXES = "xyc" ;
51
+
52
+ private static final String ID = "l2" ;
51
53
52
54
53
55
/**
@@ -63,7 +65,25 @@ public EfficientViTSAML2() {
63
65
this .speedRank = 1 ;
64
66
this .performanceRank = 5 ;
65
67
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 ;
67
87
}
68
88
69
89
@ Override
Original file line number Diff line number Diff line change @@ -48,6 +48,8 @@ public class EfficientViTSAMXL0 extends SAMModel {
48
48
* Axes order required for the input image by the model
49
49
*/
50
50
public static final String INPUT_IMAGE_AXES = "xyc" ;
51
+
52
+ private static final String ID = "xl0" ;
51
53
52
54
/**
53
55
* Create an instance of the model that loads the model and encodes an image
@@ -62,7 +64,25 @@ public EfficientViTSAMXL0() {
62
64
this .speedRank = 3 ;
63
65
this .performanceRank = 3 ;
64
66
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 ;
66
86
}
67
87
68
88
@ Override
Original file line number Diff line number Diff line change @@ -49,6 +49,8 @@ public class EfficientViTSAMXL1 extends SAMModel {
49
49
* Axes order required for the input image by the model
50
50
*/
51
51
public static final String INPUT_IMAGE_AXES = "xyc" ;
52
+
53
+ private static final String ID = "xl1" ;
52
54
53
55
54
56
/**
@@ -66,6 +68,24 @@ public EfficientViTSAMXL1() {
66
68
this .size = 814 ;
67
69
this .manager = EfficientViTSamEnvManager .create (EfficientViTSamEnvManager .DEFAULT_DIR , "xl1" );
68
70
}
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
+ }
69
89
70
90
@ Override
71
91
/**
Original file line number Diff line number Diff line change @@ -69,6 +69,26 @@ public SAM2Large() {
69
69
this .size = Math .round (10 * Sam2EnvManager .SAM2_BYTE_SIZES_MAP .get (ID ) / ((double ) ( 1024 * 1024 ))) / 10.0 ;
70
70
this .manager = Sam2EnvManager .create (Sam2EnvManager .DEFAULT_DIR , ID );
71
71
}
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
+ }
72
92
73
93
@ Override
74
94
/**
Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ public class SAM2Small extends SAMModel {
50
50
public static final String INPUT_IMAGE_AXES = "xyc" ;
51
51
52
52
private static String ID = "small" ;
53
-
53
+
54
54
55
55
/**
56
56
* Create an instance of the model that loads the model and encodes an image
@@ -68,6 +68,25 @@ public SAM2Small() {
68
68
this .size = Math .round (10 * Sam2EnvManager .SAM2_BYTE_SIZES_MAP .get (ID ) / ((double ) ( 1024 * 1024 ))) / 10.0 ;
69
69
this .manager = Sam2EnvManager .create (Sam2EnvManager .DEFAULT_DIR , ID );
70
70
}
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
+ }
71
90
72
91
@ Override
73
92
/**
Original file line number Diff line number Diff line change @@ -68,6 +68,26 @@ public SAM2Tiny() {
68
68
this .size = Math .round (10 * Sam2EnvManager .SAM2_BYTE_SIZES_MAP .get (ID ) / ((double ) ( 1024 * 1024 ))) / 10.0 ;
69
69
this .manager = Sam2EnvManager .create (Sam2EnvManager .DEFAULT_DIR , ID );
70
70
}
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
+ }
71
91
72
92
@ Override
73
93
/**
You can’t perform that action at this time.
0 commit comments