Train a model to classify and localize triangles and rectangles
This example page shows inference with a pretrained object-detection model that can classify and localize (i.e., give the position of) target shapes in simple synthesized scenes. The training happens in tfjs-node (see train.js in the source folder).
The target objects that we want to detect are triangles and rectangles, in the background are line segments and circles that the model should ignore. Each synthetic scene contains only one target object. Each inference by the model generates the bounding box of the target object (show as the blue box), which can be compared with the true bounding box (show as the red box). In addition, the inference output contains the class of the shape (triangle vs. rectangle).