PytorchLite class
Utility class for loading and using PyTorch Lite models.
Provides static methods for loading classification and object detection models, as well as helper functions for processing model outputs and loading labels. This class serves as a bridge between the Flutter app and the native PyTorch implementation. Loads a classification model from the specified asset path.
Creates a ClassificationModel instance with the loaded PyTorch model and optional label mappings for prediction results.
@param path The asset path to the PyTorch model file @param imageWidth The expected width for input images @param imageHeight The expected height for input images @param labelPath Optional path to a labels file (.txt or .csv format) @return A Future that completes with a ClassificationModel instance
Constructors
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
loadClassificationModel(
String path, int imageWidth, int imageHeight, {String? labelPath}) → Future< ClassificationModel> - Sets pytorch model path and returns Model
-
loadObjectDetectionModel(
String path, int numberOfClasses, int imageWidth, int imageHeight, {String? labelPath}) → Future< ModelObjectDetection> - Loads an object detection model from the specified asset path.