Added a test for getting labels from iOS image segmenter

This commit is contained in:
Prianka Liz Kariat 2023-10-09 17:47:03 +05:30
parent dd823d16f8
commit fce7b19ad7

View File

@ -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 #pragma mark - Image Segmenter Initializers
- (MPPImageSegmenterOptions *)imageSegmenterOptionsWithModelFileInfo:(MPPFileInfo *)fileInfo { - (MPPImageSegmenterOptions *)imageSegmenterOptionsWithModelFileInfo:(MPPFileInfo *)fileInfo {