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

Merge branch 'dev' into 'main'

Set of commits to be tagged v0.19

See merge request !12
parents 951fc576 8092e15a
No related branches found
No related tags found
1 merge request!12Set of commits to be tagged v0.19
[tool.poetry] [tool.poetry]
name = "MaggotUBA-adapter" name = "MaggotUBA-adapter"
version = "0.18" version = "0.19"
description = "Interface between MaggotUBA and the Nyx tagging UI" description = "Interface between MaggotUBA and the Nyx tagging UI"
authors = ["François Laurent"] authors = ["François Laurent"]
license = "MIT" license = "MIT"
...@@ -14,7 +14,7 @@ maggotuba-core = {git = "https://gitlab.pasteur.fr/nyx/MaggotUBA-core", tag = "v ...@@ -14,7 +14,7 @@ maggotuba-core = {git = "https://gitlab.pasteur.fr/nyx/MaggotUBA-core", tag = "v
torch = "^1.11.0" torch = "^1.11.0"
numpy = "^1.19.3" numpy = "^1.19.3"
protobuf = "3.9.2" protobuf = "3.9.2"
taggingbackends = {git = "https://gitlab.pasteur.fr/nyx/TaggingBackends", rev = "v0.17"} taggingbackends = {git = "https://gitlab.pasteur.fr/nyx/TaggingBackends", rev = "v0.18"}
[build-system] [build-system]
requires = ["poetry-core>=1.0.0"] requires = ["poetry-core>=1.0.0"]
......
attrdict==2.0.1
certifi==2023.11.17
charset-normalizer==3.3.2
h5py==3.1.0
hdf5storage==0.1.19
idna==3.6
julia==0.5.7
numpy==1.24.4
nvidia-cublas-cu11==11.10.3.66
nvidia-cuda-nvrtc-cu11==11.7.99
nvidia-cuda-runtime-cu11==11.7.99
nvidia-cudnn-cu11==8.5.0.96
pandas==1.3.3
Pillow==10.1.0
protobuf==3.9.2
python-dateutil==2.8.2
pytz==2023.3.post1
PyYAML==6.0.1
requests==2.31.0
six==1.16.0
torch==1.13.1
torchvision==0.14.1
tqdm==4.66.1
typing_extensions==4.9.0
urllib3==2.1.0
...@@ -184,7 +184,7 @@ class MaggotEncoder(MaggotModule): ...@@ -184,7 +184,7 @@ class MaggotEncoder(MaggotModule):
_reason = e _reason = e
config['load_state'] = False # for `was_pretrained` to properly work config['load_state'] = False # for `was_pretrained` to properly work
else: else:
logging.debug(f"loading neural network state: {path}") logging.debug(f"neural network state loaded: {path}")
else: else:
_reason = '"load_state" is set to false' _reason = '"load_state" is set to false'
# if state file not found or config option "load_state" is False, # if state file not found or config option "load_state" is False,
...@@ -336,8 +336,8 @@ class DeepLinear(nn.Module): ...@@ -336,8 +336,8 @@ class DeepLinear(nn.Module):
return self.layers(x) return self.layers(x)
def load(self, path): def load(self, path):
logging.debug(f"loading neural network state: {path}")
self.load_state_dict(torch.load(path)) self.load_state_dict(torch.load(path))
logging.debug(f"neural network state loaded: {path}")
def save(self, path): def save(self, path):
logging.debug(f"saving neural network state to file: {path}") logging.debug(f"saving neural network state to file: {path}")
......
...@@ -3,6 +3,11 @@ from taggingbackends.features.skeleton import get_5point_spines ...@@ -3,6 +3,11 @@ from taggingbackends.features.skeleton import get_5point_spines
from maggotuba.models.trainers import MaggotTrainer, MultiscaleMaggotTrainer, MaggotBagging, new_generator from maggotuba.models.trainers import MaggotTrainer, MultiscaleMaggotTrainer, MaggotBagging, new_generator
import numpy as np import numpy as np
import logging import logging
import os.path
tracking_data_file_extensions = ('.spine', '.outline', '.csv', '.mat', '.hdf5')
def predict_model(backend, **kwargs): def predict_model(backend, **kwargs):
""" """
...@@ -27,13 +32,13 @@ def predict_model(backend, **kwargs): ...@@ -27,13 +32,13 @@ def predict_model(backend, **kwargs):
assert 0 < len(input_files) assert 0 < len(input_files)
# initialize output labels # initialize output labels
input_files_and_labels = backend.prepare_labels(input_files) input_files_and_labels = backend.prepare_labels(input_files, single_input=True,
allowed_file_extensions=tracking_data_file_extensions)
assert 0 < len(input_files_and_labels) assert 0 < len(input_files_and_labels)
# load the model # load the model
model_files = backend.list_model_files() model_files = backend.list_model_files()
config_files = [file config_files = [file for file in model_files
for file in model_files
if file.name.endswith('config.json')] if file.name.endswith('config.json')]
if len(config_files) == 0: if len(config_files) == 0:
raise RuntimeError(f"no config files found for tagger: {backend.model_instance}") raise RuntimeError(f"no config files found for tagger: {backend.model_instance}")
......
...@@ -70,7 +70,7 @@ class MaggotTrainer: ...@@ -70,7 +70,7 @@ class MaggotTrainer:
def prepare_dataset(self, dataset, training=False): def prepare_dataset(self, dataset, training=False):
if training: if training:
self.model.clf.config['training_dataset'] = str(dataset.path) self.model.clf.config['training_dataset'] = self.model.path_for_config(dataset.path)
try: try:
dataset.batch_size dataset.batch_size
except AttributeError: except AttributeError:
......
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