Extracts the scoremap, locref, partaffinityfields (if available). Returns a dictionary indexed by: trainingsetfraction, snapshotindex, and imageindex for those keys, each item contains: (image, scmap, locref, paf, bpt_names, partaffinity_graph, imagename, True/False if this image was in
(
config,
shuffle: int = 0,
trainingsetindex: int = 0,
gputouse: int | None = None,
device: str | None = None,
rescale: bool = False,
Indices: list[int] | None = None,
modelprefix: str = "",
engine: Engine | None = None,
)
| 1592 | |
| 1593 | |
| 1594 | def extract_maps( |
| 1595 | config, |
| 1596 | shuffle: int = 0, |
| 1597 | trainingsetindex: int = 0, |
| 1598 | gputouse: int | None = None, |
| 1599 | device: str | None = None, |
| 1600 | rescale: bool = False, |
| 1601 | Indices: list[int] | None = None, |
| 1602 | modelprefix: str = "", |
| 1603 | engine: Engine | None = None, |
| 1604 | ): |
| 1605 | """Extracts the scoremap, locref, partaffinityfields (if available). |
| 1606 | |
| 1607 | Returns a dictionary indexed by: trainingsetfraction, snapshotindex, and imageindex |
| 1608 | for those keys, each item contains: (image, scmap, locref, paf, bpt_names, |
| 1609 | partaffinity_graph, imagename, True/False if this image was in trainingset). |
| 1610 | |
| 1611 | ---------- |
| 1612 | config : string |
| 1613 | Full path of the config.yaml file as a string. |
| 1614 | |
| 1615 | shuffle: integer |
| 1616 | integers specifying shuffle index of the training dataset. The default is 0. |
| 1617 | |
| 1618 | trainingsetindex: int, optional |
| 1619 | Integer specifying which TrainingsetFraction to use. By default the first (note |
| 1620 | that TrainingFraction is a list in config.yaml). This variable can also be set |
| 1621 | to "all". |
| 1622 | |
| 1623 | gputouse: int or None, optional, default=None |
| 1624 | For the TensorFlow engine (for the PyTorch engine see ``device``). Specifies |
| 1625 | the GPU to use (see number in ``nvidia-smi``). If you do not have a GPU put |
| 1626 | ``None``. See: https://nvidia.custhelp.com/app/answers/detail/a_id/3751/~/useful-nvidia-smi-queries |
| 1627 | |
| 1628 | device: str or None, optional, default=None |
| 1629 | The CUDA device to use for training. If None, the device will be taken from the |
| 1630 | ``pytorch_config.yaml`` file. Examples: {"cpu", "cuda", "cuda:0", "cuda:1"}. See |
| 1631 | https://pytorch.org/docs/stable/notes/cuda.html for more information. |
| 1632 | |
| 1633 | rescale: bool, default False |
| 1634 | Evaluate the model at the 'global_scale' variable |
| 1635 | (as set in the test/pose_config.yaml file for a particular project). |
| 1636 | I.e. every image will be resized according to that scale and prediction |
| 1637 | will be compared to the resized ground truth. |
| 1638 | The error will be reported in pixels at rescaled to the *original* size. |
| 1639 | I.e. For a [200,200] pixel image evaluated at global_scale=.5, the predictions are calculated |
| 1640 | on [100,100] pixel images, compared to 1/2*ground truth and this error is then multiplied by 2!. |
| 1641 | The evaluation images are also shown for the original size! |
| 1642 | |
| 1643 | engine: Engine, optional, default = None. |
| 1644 | The default behavior loads the engine for the shuffle from the metadata. You can |
| 1645 | overwrite this by passing the engine as an argument, but this should generally |
| 1646 | not be done. |
| 1647 | |
| 1648 | Examples |
| 1649 | -------- |
| 1650 | If you want to extract the data for image 0 and 103 (of the training set) for model trained with shuffle 0. |
| 1651 | >>> deeplabcut.extract_maps(configfile,0,Indices=[0,103]) |
nothing calls this directly
no test coverage detected