Skip to content

Show inspection results on a panel ​

A panel is the screen the operators of a line look at: the image of each product with what the model found, and the verdict. Panels are pages of the controller's dashboard, and a flow fills them with widgets. In this guide you create a page and show each pack of biscuits on it with Rosepetal's image canvas, the widget the demo panels use.

What you will learn

  • How pages, groups and widgets make up a panel
  • How to show an image with its predictions on the image canvas
  • Where to find the panel in the platform

Before you start

Here the flow streams the packs of a dataset through a segmentation model, as in Decide pass or fail from the predictions. Two nodes prepare each image for the screen: rp-resize makes it a JPEG of 1024 pixels, and the function node «To the panel» puts it, with the outline of each biscuit and the verdict, in the shape the canvas reads (see «The message for the canvas» below).

1. Add an image canvas ​

Type ui-canvas-fabric in «filter nodes» and drag the «canvas fabric» node, in the «Renders» category, after the function node «To the panel». Wire them. It is Rosepetal's image canvas: it shows the image with boxes, outlines or masks on top, and the verdict.

Add an image canvas

2. Create a group for it ​

Double-click the node. A widget always goes in a group, a box on the panel with a title, and a group in a page. Click «+» next to «Group» and name the new group, here «Inspection». Its «Size» is its width in columns: a page is 12 columns wide, and this group takes 6.

Create a group for it

3. Create the page ​

Click «+» next to «Page». Name the page, here «Biscuit line», and choose the dashboard of the controller in «UI», «Rosepetal Demos». «Path» is its address, /biscuit-line, and «Icon» the icon of the menu, a name from Material Design Icons such as cookie. In «Theme», choose the theme of the other pages.

Create the page

4. Add the page and the group ​

Click «Add»: the page is created and chosen in the group. Click «Add» again: you are back in the canvas node, with the group chosen.

5. Set up the canvas ​

«Size» is 6 columns by 8 rows: click it and drag over the grid to change it. Further down, set «Image types» to 1 and name the type «Pack»: the canvas shows the image the message carries under that name, in msg.payload.imageShow.Pack. With several types, the operator switches between them, for example between the original image and one with the defects marked. «Result card title» names the card that shows the verdict.

Set up the canvas

6. Deploy and start the line ​

Click «Done» and «Deploy», and press the «start» inject node. The packs of the dataset go through the model one after another, and each one goes to the panel.

7. Open the panel ​

Click «Panels» in the top bar. The menu on the left lists the pages of the controller's dashboard, and «Biscuit line» is among them now. The canvas shows each pack with the outline of each biscuit the model found, in green when the pack passes and in red when it fails, and the result card says OK or NOK.

Open the panel

8. Hide the outlines ​

The checkbox «POLYGONS», under the image, hides the outlines and shows them again, to see the product itself. The buttons above the image adjust its brightness, bring back the whole image, keep the zoom for the next images and show it full screen; see Open and operate a panel.

Hide the outlines

The message for the canvas ​

The canvas reads the image as a JPEG in a data URL, and each shape with positions from 0 to 1, the way the inferencer gives them. «To the panel» builds that message from the image and the predictions:

js
// The biscuits the model is sure of, and the verdict: four make a good pack
const min = flow.get("confidence") ?? 0.5;
const found = msg.inference.filter((b) => b.confidence >= min);
const result = found.length === 4 ? "OK" : "NOK";
// An outline has about a thousand points: one in six is enough to draw it
const light = (points) => points.filter((p, i) => i % 6 === 0);
msg.payload = {
  imageShow: { Pack: { imageData: "data:image/jpeg;base64," + msg.jpg.toString("base64") } },
  polygons: found.flatMap((b) => b.polygons.map((points) => ({
    points: light(points), color: result === "OK" ? "rgb(46,160,67)" : "rgb(229,57,53)", tag: b.tag, confidence: b.confidence,
  }))),
  result,
  isAnomalous: result === "NOK",
};
return msg;
  • imageShow.Pack.imageData is the image, under the name of its image type. imageShow.Pack.bbox takes boxes instead, for a detection model: { x_rel, y_rel, w_rel, h_rel, tag, score, color }.
  • polygons are the outlines, for segmentation: { points, color, tag, confidence }.
  • result colours the bar above the image, and isAnomalous makes the result card say NOK (true) or OK (false).

Good to know ​

  • Who sees the page. A page is on the controller, so everyone who opens «Panels» on that controller sees it in the menu.
  • More widgets. The «dashboard 2» categories of the palette hold text, gauges, charts and tables, and Rosepetal's own: image logs, charts of results, buttons with confirmation.

Next steps ​

Recorded on Rosepetal release 1.8.15, Node-RED 5.0.10.