renom_img.api.inference

class Detector ( url='http://localhost' , port='8080' )

Bases: object

This class allows you to pull models trained in the ReNomIMG GUI.

Parameters:
  • url ( string ) – The running ReNomIMG server URL.
  • port ( string ) – The running ReNomIMG server port number.
model_info

This function returns information of pulled model.

Example

>>> from renom_img.api.inference.detector import Detector
>>> detector = Detector()
>>> detector.pull()
>>> print(detector.model_info)
predict ( img_list )

Perform prediction for the given image.

Parameters: img_list ( string , list , ndarray ) – Path to the image, list of path or ndarray can be passed.

Example

>>> from renom_img.api.inference.detector import Detector
>>> detector = Detector()
>>> detector.pull()
>>> detector.predict(path_to_image)
{
  {'box':[0.2, 0.1, 0.5, 0.3], 'class':0, 'name': 'dog', 'score':0.5}
}
pull ( )

Pull trained weights from ReNomIMG server. Trained weight will be downloaded into current directory.

Example

>>> from renom_img.api.inference.detector import Detector
>>> detector = Detector()
>>> detector.pull()
class Classifier ( url='http://localhost' , port='8080' )

Bases: object

This class allows you to pull trained classification models that are deployed on the ReNomIMG GUI.

Parameters:
  • url ( string ) – The running ReNomIMG server URL.
  • port ( string ) – The running ReNomIMG server port number.
model_info

This function returns the information of the model you have downloaded.

Example

>>> from renom_img.api.inference.classifier import Classifier
>>> classifier = Classifier()
>>> classifier.pull()
>>> print(classifier.model_info)
predict ( img_list , return_scores=False )

Perform prediction for the given image(s).

Parameters:
  • img_list ( string , list , ndarray ) – Accepts an image path as a string, list of image paths or an image converted to a numpy array.
  • return_scores ( boolean ) – Flag to return prediction scores for all classes for each image. Default is False.
Returns:

List of predicted classes for each image

Example

>>> from renom_img.api.inference.classifier import Classifier
>>> classifier = Classifier()
>>> classifier.pull()
>>>
>>> classifier.predict(path_to_image)
     3  # Predicts class index = 3 (index starts from 0)
>>>
>>> # Return scores for all classes by setting 'return_scores' = True)
>>> classifier.predict(path_to_image, return_scores=True)
     (3, array([[0., 0., 0.0150, 0.9850]], dtype=float32))  # Predicts class index = 3, with score = 98.50%
}
pull ( )

Download trained weights for the deployed classification model from the ReNomIMG server. The trained weights will be downloaded into the current working directory.

Example

>>> from renom_img.api.inference.classifier import Classifier
>>> classifier = Classifier()
>>> classifier.pull()
class Segmenter ( url='http://localhost' , port='8080' )

Bases: object

This class allows you to pull trained segmentation models that are deployed on the ReNomIMG GUI.

Parameters:
  • url ( string ) – The running ReNomIMG server URL.
  • port ( string ) – The running ReNomIMG server port number.
model_info

This function returns the information of the model you have downloaded.

Example

>>> from renom_img.api.inference.segmenter import Segmenter
>>> segmenter = Segmenter()
>>> segmenter.pull()
>>> print(segmenter.model_info)
predict ( img_list )

Perform prediction for the given image(s).

Parameters: img_list ( string , list , ndarray ) – Accepts an image path as a string, list of image paths or an image converted to a numpy array.
Returns: List of predicted classes for each image

Example

>>> from renom_img.api.inference.segmenter import Segmenter
>>> segmenter = Segmenter()
>>> segmenter.pull()
>>> segmenter.predict(path_to_image)
}
pull ( )

Download trained weights for the deployed segmentation model from the ReNomIMG server. The trained weights will be downloaded into the current working directory.

Example

>>> from renom_img.api.inference.segmenter import Segmenter
>>> segmenter = Segmenter()
>>> segmenter.pull()