Added stream info for some modes in MPPImageClassifier

This commit is contained in:
Prianka Liz Kariat 2023-03-23 19:51:25 +05:30
parent aa760855ee
commit 59e0b1ba74
3 changed files with 9 additions and 2 deletions

View File

@ -20,6 +20,7 @@ NS_ASSUME_NONNULL_BEGIN
@interface MPPBaseOptions (Helpers) @interface MPPBaseOptions (Helpers)
- (void)copyToProto:(mediapipe::tasks::core::proto::BaseOptions *)baseOptionsProto; - (void)copyToProto:(mediapipe::tasks::core::proto::BaseOptions *)baseOptionsProto;
- (void)copyToProto:(mediapipe::tasks::core::proto::BaseOptions *)baseOptionsProto withUseStreamMode:(BOOL)useStreamMode;
@end @end

View File

@ -22,6 +22,11 @@ using BaseOptionsProto = ::mediapipe::tasks::core::proto::BaseOptions;
@implementation MPPBaseOptions (Helpers) @implementation MPPBaseOptions (Helpers)
- (void)copyToProto:(BaseOptionsProto *)baseOptionsProto withUseStreamMode:(BOOL)useStreamMode {
[self copyToProto:baseOptionsProto];
baseOptionsProto->set_use_stream_mode(useStreamMode);
}
- (void)copyToProto:(BaseOptionsProto *)baseOptionsProto { - (void)copyToProto:(BaseOptionsProto *)baseOptionsProto {
baseOptionsProto->Clear(); baseOptionsProto->Clear();

View File

@ -32,8 +32,9 @@ using ClassifierOptionsProto = ::mediapipe::tasks::components::processors::proto
- (void)copyToProto:(CalculatorOptionsProto *)optionsProto { - (void)copyToProto:(CalculatorOptionsProto *)optionsProto {
ImageClassifierGraphOptionsProto *graphOptions = ImageClassifierGraphOptionsProto *graphOptions =
optionsProto->MutableExtension(ImageClassifierGraphOptionsProto::ext); optionsProto->MutableExtension(ImageClassifierGraphOptionsProto::ext);
[self.baseOptions copyToProto:graphOptions->mutable_base_options()];
[self.baseOptions copyToProto:graphOptions->mutable_base_options() withUseStreamMode:self.runningMode != MPPRunningModeImage];
ClassifierOptionsProto *classifierOptionsProto = graphOptions->mutable_classifier_options(); ClassifierOptionsProto *classifierOptionsProto = graphOptions->mutable_classifier_options();
classifierOptionsProto->Clear(); classifierOptionsProto->Clear();