Prediction displays
confidencePlot
marcelle.confidencePlot(
predictionStream: Stream<Prediction>
): ConfidencePlot;
Plot prediction result in real-time from a reactive stream of predictions, where each event implements the following interface:
interface Prediction {
id?: ObjectId;
instanceId: ObjectId;
label?: string;
trueLabel?: string;
confidences?: Record<string, number>;
[key: string]: any;
}
Parameters
Option | Type | Description | Required |
---|
predictionStream | Stream<Prediction> | a stream of Prediction objects | ✓ |
Screenshot
Example
const predictionStream = $features.map((feat) => classifier.predict(feat)).awaitPromises();
const plotResults = marcelle.confidencePlot(predictionStream);
detectionBoxes
marcelle.detectionBoxes(
imgStream: Stream<ImageData>,
objDectectionRes: Stream<ObjectDetectorResults>
): DetectionBoxes;
Plot detection boxes on an image given by a segmentation algorithm. ObjectDetectorResults
has the following interface:
interface ObjectDetectorResults {
outputs: {
bbox: [number, number, number, number];
class: string;
confidence: number;
}[];
}
Parameters
Option | Type | Description | Required |
---|
imgStream | Stream<ImageData> | A stream of image | ✓ |
objDectectionRes | Stream<ObjectDetectorResults> | A stream of object detection results | ✓ |
Example
const source = imageUpload();
const cocoClassifier = cocoSsd();
const cocoPredictionStream = source.$images
.map(async (img) => cocoClassifier.predict(img))
.awaitPromises();
const cocoBetterPredictions = cocoPredictionStream.map(({ outputs }) => ({
label: outputs[0].class,
confidences: outputs.reduce((x, y) => ({ ...x, [y.class]: y.confidence }), {}),
}));
const objDetectionVis = detectionBoxes(source.$images, cocoPredictionStream);
ConfusionMatrix
marcelle.confusionMatrix(prediction: BatchPrediction): Confusion;
Displays a confusion matrix from a BatchPrediction component.
Parameters
Option | Type | Description | Required |
---|
prediction | BatchPrediction | A batch prediction component storing a set of predictions | ✓ |
Streams
Name | Type | Description | Hold |
---|
$confusion | Stream<Array<{ x: string; y: string; v: number; }>> | Current confusion matrix | ✓ |
$accuracy | Stream<number> | Current accuracy | ✓ |
$labels | Stream<string[]> | current list of labels | ✓ |
$selected | Stream<{ x: string; y: string; v: number }> | Selected value | ✓ |
$progress | Stream<number | false> | Progress of the computation | ✓ |
Screenshot
Example
const batchMLP = marcelle.batchPrediction('mlp', store);
const confusionMatrix = marcelle.confusionMatrix(batchMLP);