@@ -87,8 +87,9 @@ public final class ImageSegmenter extends BaseVisionTaskApi {
8787 *
8888 * @param modelPath path of the segmentation model with metadata in the assets
8989 * @throws IOException if an I/O error occurs when loading the tflite model
90- * @throws AssertionError if error occurs when creating {@link ImageSegmenter} from the native
91- * code
90+ * @throws IllegalArgumentException if an argument is invalid
91+ * @throws IllegalStateException if there is an internal error
92+ * @throws RuntimeException if there is an otherwise unspecified error
9293 */
9394 public static ImageSegmenter createFromFile (Context context , String modelPath )
9495 throws IOException {
@@ -100,8 +101,9 @@ public static ImageSegmenter createFromFile(Context context, String modelPath)
100101 *
101102 * @param modelFile the segmentation model {@link File} instance
102103 * @throws IOException if an I/O error occurs when loading the tflite model
103- * @throws AssertionError if error occurs when creating {@link ImageSegmenter} from the native
104- * code
104+ * @throws IllegalArgumentException if an argument is invalid
105+ * @throws IllegalStateException if there is an internal error
106+ * @throws RuntimeException if there is an otherwise unspecified error
105107 */
106108 public static ImageSegmenter createFromFile (File modelFile ) throws IOException {
107109 return createFromFileAndOptions (modelFile , ImageSegmenterOptions .builder ().build ());
@@ -113,8 +115,8 @@ public static ImageSegmenter createFromFile(File modelFile) throws IOException {
113115 *
114116 * @param modelBuffer a direct {@link ByteBuffer} or a {@link MappedByteBuffer} of the
115117 * segmentation model
116- * @throws AssertionError if error occurs when creating {@link ImageSegmenter} from the native
117- * code
118+ * @throws IllegalStateException if there is an internal error
119+ * @throws RuntimeException if there is an otherwise unspecified error
118120 * @throws IllegalArgumentException if the model buffer is not a direct {@link ByteBuffer} or a
119121 * {@link MappedByteBuffer}
120122 */
@@ -127,8 +129,9 @@ public static ImageSegmenter createFromBuffer(final ByteBuffer modelBuffer) {
127129 *
128130 * @param modelPath path of the segmentation model with metadata in the assets
129131 * @throws IOException if an I/O error occurs when loading the tflite model
130- * @throws AssertionError if error occurs when creating {@link ImageSegmenter} from the native
131- * code
132+ * @throws IllegalArgumentException if an argument is invalid
133+ * @throws IllegalStateException if there is an internal error
134+ * @throws RuntimeException if there is an otherwise unspecified error
132135 */
133136 public static ImageSegmenter createFromFileAndOptions (
134137 Context context , String modelPath , final ImageSegmenterOptions options ) throws IOException {
@@ -146,8 +149,9 @@ public static ImageSegmenter createFromFileAndOptions(
146149 *
147150 * @param modelFile the segmentation model {@link File} instance
148151 * @throws IOException if an I/O error occurs when loading the tflite model
149- * @throws AssertionError if error occurs when creating {@link ImageSegmenter} from the native
150- * code
152+ * @throws IllegalArgumentException if an argument is invalid
153+ * @throws IllegalStateException if there is an internal error
154+ * @throws RuntimeException if there is an otherwise unspecified error
151155 */
152156 public static ImageSegmenter createFromFileAndOptions (
153157 File modelFile , final ImageSegmenterOptions options ) throws IOException {
@@ -167,8 +171,8 @@ public static ImageSegmenter createFromFileAndOptions(
167171 *
168172 * @param modelBuffer a direct {@link ByteBuffer} or a {@link MappedByteBuffer} of the
169173 * segmentation model
170- * @throws AssertionError if error occurs when creating {@link ImageSegmenter} from the native
171- * code
174+ * @throws IllegalStateException if there is an internal error
175+ * @throws RuntimeException if there is an otherwise unspecified error
172176 * @throws IllegalArgumentException if the model buffer is not a direct {@link ByteBuffer} or a
173177 * {@link MappedByteBuffer}
174178 */
@@ -282,7 +286,8 @@ public abstract static class Builder {
282286 * Segmentation} element is expected to be returned. The result is stored in a {@link List}
283287 * for later extension to e.g. instance segmentation models, which may return one segmentation
284288 * per object.
285- * @throws AssertionError if error occurs when segmenting the image from the native code
289+ * @throws IllegalStateException if there is an internal error
290+ * @throws RuntimeException if there is an otherwise unspecified error
286291 * @throws IllegalArgumentException if the color space type of image is unsupported
287292 */
288293 public List <Segmentation > segment (TensorImage image ) {
@@ -315,7 +320,8 @@ public List<Segmentation> segment(TensorImage image) {
315320 * Segmentation} element is expected to be returned. The result is stored in a {@link List}
316321 * for later extension to e.g. instance segmentation models, which may return one segmentation
317322 * per object.
318- * @throws AssertionError if error occurs when segmenting the image from the native code
323+ * @throws IllegalStateException if there is an internal error
324+ * @throws RuntimeException if there is an otherwise unspecified error
319325 * @throws IllegalArgumentException if the color space type of image is unsupported
320326 */
321327 public List <Segmentation > segment (TensorImage image , ImageProcessingOptions options ) {
@@ -339,7 +345,8 @@ public List<Segmentation> run(
339345 * Segmentation} element is expected to be returned. The result is stored in a {@link List}
340346 * for later extension to e.g. instance segmentation models, which may return one segmentation
341347 * per object.
342- * @throws AssertionError if error occurs when segmenting the image from the native code
348+ * @throws IllegalStateException if there is an internal error
349+ * @throws RuntimeException if there is an otherwise unspecified error
343350 * @throws IllegalArgumentException if the storage type or format of the image is unsupported
344351 */
345352 public List <Segmentation > segment (MlImage image ) {
@@ -364,7 +371,8 @@ public List<Segmentation> segment(MlImage image) {
364371 * Segmentation} element is expected to be returned. The result is stored in a {@link List}
365372 * for later extension to e.g. instance segmentation models, which may return one segmentation
366373 * per object.
367- * @throws AssertionError if error occurs when segmenting the image from the native code
374+ * @throws IllegalStateException if there is an internal error
375+ * @throws RuntimeException if there is an otherwise unspecified error
368376 * @throws IllegalArgumentException if the color space type of image is unsupported
369377 */
370378 public List <Segmentation > segment (MlImage image , ImageProcessingOptions options ) {
0 commit comments