Skip to content
Snippets Groups Projects
Commit 8ce38d03 authored by François  LAURENT's avatar François LAURENT
Browse files

Merge branch 'save_dataset' into 'dev'

Save larva_dataset file along with model files

See merge request !8
parents 1df5541d dcb44a01
No related branches found
No related tags found
2 merge requests!9Set of commits to be tagged 0.16,!8LarvaDataset.path property for larva_dataset file copying
Pipeline #117367 failed
...@@ -312,11 +312,11 @@ version = "1.9.2" ...@@ -312,11 +312,11 @@ version = "1.9.2"
[[deps.PlanarLarvae]] [[deps.PlanarLarvae]]
deps = ["DelimitedFiles", "HDF5", "JSON3", "LinearAlgebra", "MAT", "Meshes", "OrderedCollections", "Random", "SHA", "StaticArrays", "Statistics", "StatsBase", "StructTypes"] deps = ["DelimitedFiles", "HDF5", "JSON3", "LinearAlgebra", "MAT", "Meshes", "OrderedCollections", "Random", "SHA", "StaticArrays", "Statistics", "StatsBase", "StructTypes"]
git-tree-sha1 = "3672831638c71be6e111ffde3376580d0d2bfaf5" git-tree-sha1 = "6b2dc28d56bcef101672cbf2bb784bbd5d88d579"
repo-rev = "3bffeb68ab85f82c048bcb5aea3d19048e211ef9" repo-rev = "main"
repo-url = "https://gitlab.pasteur.fr/nyx/PlanarLarvae.jl" repo-url = "https://gitlab.pasteur.fr/nyx/PlanarLarvae.jl"
uuid = "c2615984-ef14-4d40-b148-916c85b43307" uuid = "c2615984-ef14-4d40-b148-916c85b43307"
version = "0.14.0" version = "0.15.0"
[[deps.PrecompileTools]] [[deps.PrecompileTools]]
deps = ["Preferences"] deps = ["Preferences"]
......
...@@ -26,16 +26,29 @@ class LarvaDataset: ...@@ -26,16 +26,29 @@ class LarvaDataset:
self.weight_classes = isinstance(balancing_strategy, str) and (balancing_strategy.lower() == 'auto') self.weight_classes = isinstance(balancing_strategy, str) and (balancing_strategy.lower() == 'auto')
else: else:
self.class_weights = class_weights self.class_weights = class_weights
self._path = None
""" """
*h5py.File*: *larva_dataset hdf5* file handler. *h5py.File*: *larva_dataset hdf5* file handler.
""" """
@property @property
def full_set(self): def full_set(self):
if isinstance(self._full_set, (str, pathlib.Path)): if not isinstance(self._full_set, h5py.File):
self._full_set = h5py.File(str(self._full_set), "r") self._full_set = h5py.File(str(self.path), "r")
return self._full_set 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. *list* of *bytes*: Set of distinct labels.
If the hdf5 file does not feature a top-level `labels` element that lists If the hdf5 file does not feature a top-level `labels` element that lists
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment