Class Criteria<I,​O>

  • Type Parameters:
    I - the model input type
    O - the model output type

    public class Criteria<I,​O>
    extends java.lang.Object
    The Criteria class contains search criteria to look up a ZooModel.

    Criteria follows Builder pattern. See Criteria.Builder for detail. In DJL's builder convention, the methods start with set are required fields, and opt for optional fields.

    Examples

     Criteria<Image, Classifications> criteria = Criteria.builder()
             .setTypes(Image.class, Classifications.class) // defines input and output data type
             .optTranslator(ImageClassificationTranslator.builder().setSynsetArtifactName("synset.txt").build())
             .optModelUrls("file:///var/models/my_resnet50") // search models in specified path
             .optModelName("resnet50") // specify model file prefix
             .build();
     

    See Model loading for more detail.

    • Method Detail

      • getApplication

        public Application getApplication()
        Returns the application of the model.
        Returns:
        the application of the model
      • getInputClass

        public java.lang.Class<I> getInputClass()
        Returns the input data type.
        Returns:
        the input data type
      • getOutputClass

        public java.lang.Class<O> getOutputClass()
        Returns the output data type.
        Returns:
        the output data type
      • getEngine

        public java.lang.String getEngine()
        Returns the engine name.
        Returns:
        the engine name
      • getDevice

        public Device getDevice()
        Returns the Device of the model to be loaded on.
        Returns:
        the Device of the model to be loaded on
      • getGroupId

        public java.lang.String getGroupId()
        Returns the groupId of the ModelZoo to be searched.
        Returns:
        the groupId of the ModelZoo to be searched
      • getArtifactId

        public java.lang.String getArtifactId()
        Returns the artifactId of the ModelLoader to be searched.
        Returns:
        the artifactIds of the ModelLoader to be searched
      • getFilters

        public java.util.Map<java.lang.String,​java.lang.String> getFilters()
        Returns the search filters that must match the properties of the model.
        Returns:
        the search filters that must match the properties of the model.
      • getArguments

        public java.util.Map<java.lang.String,​java.lang.Object> getArguments()
        Returns the override configurations of the model loading arguments.
        Returns:
        the override configurations of the model loading arguments
      • getOptions

        public java.util.Map<java.lang.String,​java.lang.String> getOptions()
        Returns the model loading options.
        Returns:
        the model loading options
      • getModelName

        public java.lang.String getModelName()
        Returns the optional model name to be used for ZooModel.
        Returns:
        the optional model name to be used for ZooModel
      • getProgress

        public ai.djl.util.Progress getProgress()
        Returns the optional Progress for the model loading.
        Returns:
        the optional Progress for the model loading
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • builder

        public static Criteria.Builder<?,​?> builder()
        Creates a builder to build a Criteria.

        The methods start with set are required fields, and opt for optional fields.

        Returns:
        a new builder