Updated MPPVisionTaskRunner

This commit is contained in:
Prianka Liz Kariat 2023-02-16 01:31:29 +05:30
parent a0253274cc
commit a503fb53e0
3 changed files with 11 additions and 13 deletions

View File

@ -38,9 +38,11 @@ objc_library(
], ],
deps = [ deps = [
":MPPRunningMode", ":MPPRunningMode",
"//mediapipe/tasks/ios/common:MPPCommon",
"//mediapipe/tasks/ios/common/utils:MPPCommonUtils",
"//mediapipe/tasks/ios/core:MPPTaskRunner", "//mediapipe/tasks/ios/core:MPPTaskRunner",
"//mediapipe/tasks/ios/core:MPPVisionPacketCreator",
],
)
objc_library( objc_library(
name = "MPPVisionPacketCreator", name = "MPPVisionPacketCreator",
srcs = ["sources/MPPVisionPacketCreator.mm"], srcs = ["sources/MPPVisionPacketCreator.mm"],

View File

@ -13,7 +13,6 @@
// limitations under the License. // limitations under the License.
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#import "mediapipe/tasks/ios/core/sources/MPPTaskRunner.h" #import "mediapipe/tasks/ios/core/sources/MPPTaskRunner.h"
#import "mediapipe/tasks/ios/vision/core/sources/MPPRunningMode.h" #import "mediapipe/tasks/ios/vision/core/sources/MPPRunningMode.h"
@ -42,8 +41,8 @@ NS_ASSUME_NONNULL_BEGIN
* intended to deliver inference results must be provided. In case of image or video running mode, * intended to deliver inference results must be provided. In case of image or video running mode,
* packets callback must be set to nil. * packets callback must be set to nil.
* *
* @param error Pointer to the memory location where errors if any should be saved. If @c NULL, no * @param error Pointer to the memory location where errors if any should be
* error will be saved. * saved. If @c NULL, no error will be saved.
* *
* @return An instance of `MPPVisionTaskRunner` initialized to the given MediaPipe calculator config * @return An instance of `MPPVisionTaskRunner` initialized to the given MediaPipe calculator config
* proto, running mode and packets callback. * proto, running mode and packets callback.
@ -54,11 +53,6 @@ NS_ASSUME_NONNULL_BEGIN
(mediapipe::tasks::core::PacketsCallback)packetsCallback (mediapipe::tasks::core::PacketsCallback)packetsCallback
error:(NSError **)error NS_DESIGNATED_INITIALIZER; error:(NSError **)error NS_DESIGNATED_INITIALIZER;
- (instancetype)initWithCalculatorGraphConfig:(mediapipe::CalculatorGraphConfig)graphConfig
packetsCallback:
(mediapipe::tasks::core::PacketsCallback)packetsCallback
error:(NSError **)error NS_UNAVAILABLE;
- (instancetype)init NS_UNAVAILABLE; - (instancetype)init NS_UNAVAILABLE;
+ (instancetype)new NS_UNAVAILABLE; + (instancetype)new NS_UNAVAILABLE;

View File

@ -19,7 +19,8 @@
namespace { namespace {
using ::mediapipe::CalculatorGraphConfig; using ::mediapipe::CalculatorGraphConfig;
using ::mediapipe::tasks::core::PacketsCallback; using ::mediapipe::Packet;
using ::mediapipe::tasks::core::PacketMap;
} // namespace } // namespace
@interface MPPVisionTaskRunner () { @interface MPPVisionTaskRunner () {
@ -29,9 +30,10 @@ using ::mediapipe::tasks::core::PacketsCallback;
@implementation MPPVisionTaskRunner @implementation MPPVisionTaskRunner
- (nullable instancetype)initWithCalculatorGraphConfig:(CalculatorGraphConfig)graphConfig - (nullable instancetype)initWithCalculatorGraphConfig:(mediapipe::CalculatorGraphConfig)graphConfig
runningMode:(MPPRunningMode)runningMode runningMode:(MPPRunningMode)runningMode
packetsCallback:(PacketsCallback)packetsCallback packetsCallback:
(mediapipe::tasks::core::PacketsCallback)packetsCallback
error:(NSError **)error { error:(NSError **)error {
switch (runningMode) { switch (runningMode) {
case MPPRunningModeImage: case MPPRunningModeImage: