plot_anchors
plot_anchors(anchors, boxes=None, log=False, *, model=None, split='train')Fitted anchors against the box shapes they were fitted to.
Two ways in, the same two R has, where plot_anchors() takes a fit. Give a fitted DetectionEngine and it asks the engine for both clouds in one call, colouring the boxes by class; or give the anchors and the shapes yourself.
Handing it the engine is the safer of the two and not merely the shorter: widths from one place and anchors from another is how a figure comes to show boxes in different places from where the anchors were fitted to them, which looks like a bad fit and is a bug. box_shapes returns both as fractions of the letterboxed input, which is the convention the anchors were fitted in - taking the source image instead is what had a coverage of 0.67 quoted for two years against a true 0.65.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| anchors | Any | a fitted DetectionEngine, or one group of (width, height) pairs per grid, as fractions of the input. |
required |
| boxes | np.ndarray | None | the shapes themselves, n x 2 of widths and heights, drawn underneath. Refused together with an engine, which already has them. |
None |
| log | bool | both axes on a log scale, off by default as in R. Detection datasets span a wide range of sizes - a BCCD platelet is about two fifths the side of a red cell - and a log scale spreads the classes a linear one crowds into the corner. | False |
| model | str | None | which detector, when an engine is given. The default is the first. | None |
| split | str | which split’s boxes, when an engine is given. Worth drawing for a split the anchors were not fitted on: it is the only way to see a class the anchors have nothing near. | 'train' |
Returns
| Name | Type | Description |
|---|---|---|
| Figure | A matplotlib Figure. |
Raises
| Name | Type | Description |
|---|---|---|
| PlatypusError | if both an engine and boxes are given. |
figure = plot_anchors([[(0.1, 0.1), (0.2, 0.3)], [(0.4, 0.5)]]) len(figure.axes[0].collections), figure.axes[0].get_yscale() (1, ‘linear’)