From fce7b19ad70f513fdbff8f276d3c8d1d51d5eeec Mon Sep 17 00:00:00 2001 From: Prianka Liz Kariat Date: Mon, 9 Oct 2023 17:47:03 +0530 Subject: [PATCH] Added a test for getting labels from iOS image segmenter --- .../image_segmenter/MPPImageSegmenterTests.mm | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/mediapipe/tasks/ios/test/vision/image_segmenter/MPPImageSegmenterTests.mm b/mediapipe/tasks/ios/test/vision/image_segmenter/MPPImageSegmenterTests.mm index 4954555e5..ba40db422 100644 --- a/mediapipe/tasks/ios/test/vision/image_segmenter/MPPImageSegmenterTests.mm +++ b/mediapipe/tasks/ios/test/vision/image_segmenter/MPPImageSegmenterTests.mm @@ -507,6 +507,22 @@ double softIOU(const float *mask1, const float *mask2, size_t size) { }]; } +#pragma mark GetLabelsTest + +- (void)testGetLabelsSucceeds { + MPPImageSegmenterOptions *options = + [self imageSegmenterOptionsWithModelFileInfo:kImageSegmenterModelFileInfo]; + + MPPImageSegmenter *imageSegmenter = [self createImageSegmenterWithOptionsSucceeds:options]; + + NSArray *expectedLabels = @[@"background", @"aeroplane", @"bicycle", + @"bird", @"boat", @"bottle", @"bus", @"car",@"cat", + @"chair", @"cow", @"dining table", @"dog", @"horse", @"motorbike", + @"person", @"potted plant", @"sheep", @"sofa", @"train", @"tv"]; + + XCTAssertEqualObjects(imageSegmenter.labels, expectedLabels); +} + #pragma mark - Image Segmenter Initializers - (MPPImageSegmenterOptions *)imageSegmenterOptionsWithModelFileInfo:(MPPFileInfo *)fileInfo {