Method: DeepStack::CustomModel#custom_model

Defined in:
lib/deep_stack/custom_model.rb

#custom_model(model, image, **options) ⇒ Array? Also known as: custom_inference

Return predictions using a custom model. Custom models are *.pt models that have been saved in DeepStack’s modelstore directory. See docs.deepstack.cc/custom-models/deployment/index.html

Parameters:

  • model (String)

    custom model name

  • image (Object)

    binary data or a File object

  • options (Hash)

    additional fields for DeepStack, e.g. min_confidence: 0.5

Returns:

  • (Array)

    if successful, an array of DeepStack predictions

  • (nil)

    if error



19
20
21
22
# File 'lib/deep_stack/custom_model.rb', line 19

def custom_model(model, image, **options)
  target = "vision/custom/#{model}"
  api_post(target, image, **options)&.dig('predictions')
end