Package apple.vision

Class VNRequest

  • All Implemented Interfaces:
    NSCopying, NSObject
    Direct Known Subclasses:
    VNImageBasedRequest

    public class VNRequest
    extends NSObject
    implements NSCopying
    VNRequest VNRequest objects describe the operation to be performed as well as act as the recipient of the operation's resultant observations. VNRequest objects are instantiated in a pre-configured nominal state. Prior to sending a VNRequest to a request handler to perform a desired operation, the default configuration can be changed by modifying the values of VNRequest properties. The VNRequest class itself acts as a base class and is not meant to be directly instantiated. API-Since: 11.0
    • Constructor Detail

      • VNRequest

        protected VNRequest​(org.moe.natj.general.Pointer peer)
    • Method Detail

      • accessInstanceVariablesDirectly

        public static boolean accessInstanceVariablesDirectly()
      • allocWithZone

        public static VNRequest allocWithZone​(org.moe.natj.general.ptr.VoidPtr zone)
      • automaticallyNotifiesObserversForKey

        public static boolean automaticallyNotifiesObserversForKey​(@NotNull
                                                                   @NotNull java.lang.String key)
      • cancelPreviousPerformRequestsWithTarget

        public static void cancelPreviousPerformRequestsWithTarget​(@NotNull
                                                                   @NotNull java.lang.Object aTarget)
      • cancelPreviousPerformRequestsWithTargetSelectorObject

        public static void cancelPreviousPerformRequestsWithTargetSelectorObject​(@NotNull
                                                                                 @NotNull java.lang.Object aTarget,
                                                                                 @NotNull
                                                                                 @NotNull org.moe.natj.objc.SEL aSelector,
                                                                                 @Nullable
                                                                                 @Nullable java.lang.Object anArgument)
      • classFallbacksForKeyedArchiver

        @NotNull
        public static @NotNull NSArray<java.lang.String> classFallbacksForKeyedArchiver()
      • classForKeyedUnarchiver

        @NotNull
        public static @NotNull org.moe.natj.objc.Class classForKeyedUnarchiver()
      • completionHandler

        @Nullable
        public @Nullable VNRequest.Block_completionHandler_ret completionHandler()
        [@property] completionHandler The completion handler block that will be invoked after the request has completed processing.
      • copyWithZone

        @NotNull
        public @NotNull java.lang.Object copyWithZone​(@Nullable
                                                      @Nullable org.moe.natj.general.ptr.VoidPtr zone)
        Specified by:
        copyWithZone in interface NSCopying
      • debugDescription_static

        public static java.lang.String debugDescription_static()
      • description_static

        public static java.lang.String description_static()
      • hash_static

        public static long hash_static()
      • init

        public VNRequest init()
        Creates a new VNRequest with no completion handler.
        Overrides:
        init in class NSObject
      • initWithCompletionHandler

        public VNRequest initWithCompletionHandler​(@Nullable
                                                   @Nullable VNRequest.Block_initWithCompletionHandler completionHandler)
        Creates a new VNRequest with an optional completion handler.
        Parameters:
        completionHandler - The block to be invoked after the request has completed its processing. The completion handler gets executed on the same dispatch queue as the request being executed.
      • instanceMethodSignatureForSelector

        public static NSMethodSignature instanceMethodSignatureForSelector​(org.moe.natj.objc.SEL aSelector)
      • instancesRespondToSelector

        public static boolean instancesRespondToSelector​(org.moe.natj.objc.SEL aSelector)
      • isSubclassOfClass

        public static boolean isSubclassOfClass​(org.moe.natj.objc.Class aClass)
      • keyPathsForValuesAffectingValueForKey

        @NotNull
        public static @NotNull NSSet<java.lang.String> keyPathsForValuesAffectingValueForKey​(@NotNull
                                                                                             @NotNull java.lang.String key)
      • new_objc

        public static VNRequest new_objc()
      • preferBackgroundProcessing

        public boolean preferBackgroundProcessing()
        A hint used to minimize the resource burden of the request. Memory footprint, processing footprint and/or CPU/GPU contention will be reduced (depending on the request), at the potential cost of longer execution time. This can help, for example, with ensuring UI updates and rendering are not getting blocked by Vision processing.
      • resolveClassMethod

        public static boolean resolveClassMethod​(org.moe.natj.objc.SEL sel)
      • resolveInstanceMethod

        public static boolean resolveInstanceMethod​(org.moe.natj.objc.SEL sel)
      • results

        @Nullable
        public @Nullable NSArray<? extends VNObservation> results()
        [@property] results The collection of VNObservations generated by the processing of the request. The only valid time to access this property is after the request has been processed by a request handler. If the request failed, this property will be nil; otherwise, it will be an array of zero or more VNObservation subclasses specific to the VNRequest subclass.
      • setPreferBackgroundProcessing

        public void setPreferBackgroundProcessing​(boolean value)
        A hint used to minimize the resource burden of the request. Memory footprint, processing footprint and/or CPU/GPU contention will be reduced (depending on the request), at the potential cost of longer execution time. This can help, for example, with ensuring UI updates and rendering are not getting blocked by Vision processing.
      • setUsesCPUOnly

        @Deprecated
        public void setUsesCPUOnly​(boolean value)
        Deprecated.
        This property, if set to YES, signifies that the request should be performed exclusively on the CPU and not on the GPU. The default value is NO, which signifies that the request is free to leverage the GPU to accelerate any work the request may require. API-Since: 11.0 Deprecated-Since: 17.0
      • setVersion_static

        public static void setVersion_static​(long aVersion)
      • superclass_static

        public static org.moe.natj.objc.Class superclass_static()
      • usesCPUOnly

        @Deprecated
        public boolean usesCPUOnly()
        Deprecated.
        This property, if set to YES, signifies that the request should be performed exclusively on the CPU and not on the GPU. The default value is NO, which signifies that the request is free to leverage the GPU to accelerate any work the request may require. API-Since: 11.0 Deprecated-Since: 17.0
      • version_static

        public static long version_static()
      • cancel

        public void cancel()
        Tries to abort the request as soon as possible. Results will be nil. The completionHandler (if present) will be called with an error of VNErrorRequestCancelled. API-Since: 13.0
      • currentRevision

        public static long currentRevision()
        Provides the current revision supported by the request. API-Since: 12.0
      • defaultRevision

        public static long defaultRevision()
        Provides the revision of the request that was latest for the particular SDK that was linked with the client application. API-Since: 12.0
      • revision

        public long revision()
        The specific algorithm or implementation revision that is to be used to perform the request. API-Since: 12.0
      • setRevision

        public void setRevision​(long value)
        The specific algorithm or implementation revision that is to be used to perform the request. API-Since: 12.0
      • supportedRevisions

        @NotNull
        public static @NotNull NSIndexSet supportedRevisions()
        Provides the collection of currently-supported algorithm or implementation versions for the class of request. This method allows clients to introspect at runtime what capabilities are available for each class of VNRequest in the Vision framework. API-Since: 12.0
      • computeDeviceForComputeStage

        @Nullable
        public @Nullable MLComputeDeviceProtocol computeDeviceForComputeStage​(@NotNull
                                                                              @NotNull java.lang.String computeStage)
        Determine what the currently configured compute device is for a specific compute stage.
        Parameters:
        computeStage - The compute stage to be introspected.
        Returns:
        The currently assigned compute device, or `nil` if there is no explicit assignment.
      • setComputeDeviceForComputeStage

        public void setComputeDeviceForComputeStage​(@Nullable
                                                    @Nullable MLComputeDeviceProtocol computeDevice,
                                                    @NotNull
                                                    @NotNull java.lang.String computeStage)
        Assign a specific compute device for a compute stage. It is important to note that any compute device can be configured for a given compute stage. Only when the request is performed is the validity of the (compute device / compute stage) assignments checked. Valid compute devices for a request's compute stages can be obtained via `-supportedComputeStageDevicesAndReturnError:`.
        Parameters:
        computeDevice - The compute device to assign to the compute stage. Passing nil for this parameter will remove any explicit compute device assignment, allowing Vision to select which device to use.
        computeStage - The compute stage being configured.
      • supportedComputeStageDevicesAndReturnError

        @Nullable
        public @Nullable NSDictionary<java.lang.String,​? extends NSArray<?>> supportedComputeStageDevicesAndReturnError​(@Nullable
                                                                                                                              @Nullable org.moe.natj.general.ptr.Ptr<NSError> error)
        Obtain the collection of compute device per stage that are supported by the request. This method's result is based on the current state of configuration of the target request at the time of the call.
        Parameters:
        error - The address of a variable that will be populated with the error that describes the failure. If the caller does not require this information, NULL can be passed.
        Returns:
        A dictionary of per-stage supported compute devices, or `nil` if an error occurs.
      • useStoredAccessor

        @Deprecated
        public static boolean useStoredAccessor()
        Deprecated.