(
self, image_key: str, label_key: str, stats_name: str = DataStatsKeys.LABEL_STATS, do_ccp: bool | None = True
)
| 398 | """ |
| 399 | |
| 400 | def __init__( |
| 401 | self, image_key: str, label_key: str, stats_name: str = DataStatsKeys.LABEL_STATS, do_ccp: bool | None = True |
| 402 | ): |
| 403 | self.image_key = image_key |
| 404 | self.label_key = label_key |
| 405 | self.do_ccp = do_ccp |
| 406 | |
| 407 | report_format: dict[LabelStatsKeys, Any] = { |
| 408 | LabelStatsKeys.LABEL_UID: None, |
| 409 | LabelStatsKeys.IMAGE_INTST: None, |
| 410 | LabelStatsKeys.LABEL: [{LabelStatsKeys.PIXEL_PCT: None, LabelStatsKeys.IMAGE_INTST: None}], |
| 411 | } |
| 412 | |
| 413 | if self.do_ccp: |
| 414 | report_format[LabelStatsKeys.LABEL][0].update( |
| 415 | {LabelStatsKeys.LABEL_SHAPE: None, LabelStatsKeys.LABEL_NCOMP: None} |
| 416 | ) |
| 417 | |
| 418 | super().__init__(stats_name, report_format) |
| 419 | self.update_ops(LabelStatsKeys.IMAGE_INTST, SampleOperations()) |
| 420 | |
| 421 | id_seq = ID_SEP_KEY.join([LabelStatsKeys.LABEL, "0", LabelStatsKeys.IMAGE_INTST]) |
| 422 | self.update_ops_nested_label(id_seq, SampleOperations()) |
| 423 | |
| 424 | @torch.no_grad() |
| 425 | def __call__(self, data: Mapping[Hashable, MetaTensor]) -> dict[Hashable, MetaTensor | dict]: |
nothing calls this directly
no test coverage detected