Skip to content
Snippets Groups Projects

LarvaDataset.path property for larva_dataset file copying

Merged François LAURENT requested to merge save_dataset into dev
2 files
+ 18
5
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -26,16 +26,29 @@ class LarvaDataset:
self.weight_classes = isinstance(balancing_strategy, str) and (balancing_strategy.lower() == 'auto')
else:
self.class_weights = class_weights
self._path = None
"""
*h5py.File*: *larva_dataset hdf5* file handler.
"""
@property
def full_set(self):
if isinstance(self._full_set, (str, pathlib.Path)):
self._full_set = h5py.File(str(self._full_set), "r")
if not isinstance(self._full_set, h5py.File):
self._full_set = h5py.File(str(self.path), "r")
return self._full_set
"""
*pathlib.Path*: file path.
"""
@property
def path(self):
if self._path is None:
if isinstance(self._full_set, (str, pathlib.Path)):
self.path = self._full_set
return self._path
@path.setter
def path(self, p):
self._path = p if isinstance(p, pathlib.Path) else pathlib.Path(p)
"""
*list* of *bytes*: Set of distinct labels.
If the hdf5 file does not feature a top-level `labels` element that lists
Loading