The Skincare implementation provides a web REST API to perform classification, segmentation, and feature extraction.
The calls return either a JSON dictionary or an image.
In the following, the REST commands available from the classification server.
In this document, we assume an empty string as REST prefix in the server configuration file:
"REST_API_URL_PREFIX": "",
Returns information about the classifiers.
- path:
/info - method: GET
- input parameters: none
- returns: a JSON dictionary with information about the server.
Example:
{
"classification": {
"model_file": "../Model-ISIC2019-8cls-VGG16flat-227px-20k/0-keras_model.h5"
}
}Classification is the process of analyzing an image of a lesion and returning the probability distribution among the classes.
- path:
/classify - method: POST
- input parameters:
file: the image to classify. Must be a JPEG or PNG image. No alpha.
- returns: a JSON structure with info about the classification with the following fields:
errorIf there was an error, otherwise this entry is absentfilenameThe name of the file provided as inputpredictionAn array with the probability distribution. By definition, elements sum to 1.0.confidenceAn array with the confidence level, in a range [-1.0,1.0]. Only predictions with positive confidence should be taken into account.
- path:
/explain/<method>/<layer> - method: POST
- input parameters:
file: the image to classify. Must be a JPEG or PNG image. No alpha.method: is the visual explanation method. At the moment eithergradcamfor Grad-CAM, orrisefor RISE.
- returns: a JSON structure including Base64-encoded images for visual explanation:
errorIf there was an error, otherwise this entry is absentfilenameThe name of the file provided as inputmethodThe explanation method provided as inputlayer_nameThe name of the layer passed as inputgrey: A Base64-encoded greyscale PNG image of the saliency map extracted by the XAI algorithm. The resolution is the same as of the original image.heatmap: A Base64-encoded color RGB PNG image: the colorful version of the greymap.comp: A Base64-encoded color RGB PNG image with a composition between the original input image and the colored heatmap.
Segmentation is the process of taking an image as input and generating another image representing a binary mask highlighting regions of interest.
The output image is a greyscale PNG image, pixels can be only black (the pixels are outside of the regions of interest) or white (the pixels pertains to the regions of interest).
- path:
/segment - method: POST
- input parameters:
file: the image to segment. Must be a JPEG or a PNG image. No alpha.
- returns:
- In case or error, returns a JSON file with the error reason:
- Content-Type:
application/JSON error: The reason of the error
- Content-Type:
- Otherwise, returns a PNG image (same size as input), greyscale (1 channel), with the lesion mask.
- Content-Type:
image/png
- Content-Type:
- In case or error, returns a JSON file with the error reason: