(data: dict)
| 101 | |
| 102 | @staticmethod |
| 103 | def from_dict(data: dict) -> WeightInitialization: |
| 104 | if "snapshot_path" not in data: |
| 105 | return WeightInitialization.from_dict_legacy(data) |
| 106 | |
| 107 | detector_snapshot_path = data.get("detector_snapshot_path") |
| 108 | if detector_snapshot_path is not None: |
| 109 | detector_snapshot_path = Path(detector_snapshot_path) |
| 110 | |
| 111 | conversion_array = data.get("conversion_array") |
| 112 | if conversion_array is not None: |
| 113 | conversion_array = np.array(conversion_array, dtype=int) |
| 114 | |
| 115 | return WeightInitialization( |
| 116 | snapshot_path=Path(data["snapshot_path"]), |
| 117 | detector_snapshot_path=detector_snapshot_path, |
| 118 | dataset=data.get("dataset"), |
| 119 | with_decoder=data["with_decoder"], |
| 120 | memory_replay=data["memory_replay"], |
| 121 | conversion_array=conversion_array, |
| 122 | bodyparts=data.get("bodyparts"), |
| 123 | ) |
| 124 | |
| 125 | @staticmethod |
| 126 | def from_dict_legacy(data: dict) -> WeightInitialization: |
nothing calls this directly
no test coverage detected