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

Merge branch 'dev' into 20230111

parents 3056f492 910a6ee8
No related branches found
No related tags found
No related merge requests found
...@@ -5,6 +5,7 @@ from behavior_model.models.neural_nets import device ...@@ -5,6 +5,7 @@ from behavior_model.models.neural_nets import device
#import behavior_model.data.utils as data_utils #import behavior_model.data.utils as data_utils
from maggotuba.models.modules import SupervisedMaggot, MultiscaleSupervisedMaggot, MaggotBag from maggotuba.models.modules import SupervisedMaggot, MultiscaleSupervisedMaggot, MaggotBag
from taggingbackends.features.skeleton import interpolate from taggingbackends.features.skeleton import interpolate
import logging
""" """
This model borrows the pre-trained MaggotUBA encoder, substitute a dense layer This model borrows the pre-trained MaggotUBA encoder, substitute a dense layer
...@@ -94,7 +95,11 @@ class MaggotTrainer: ...@@ -94,7 +95,11 @@ class MaggotTrainer:
w = w - np.tile(wc, (1, 5)) w = w - np.tile(wc, (1, 5))
# rotate # rotate
v = np.mean(w[:,8:10] - w[:,0:2], axis=0) v = np.mean(w[:,8:10] - w[:,0:2], axis=0)
v = v / np.sqrt(np.dot(v, v)) vnorm = np.sqrt(np.dot(v, v))
if vnorm == 0:
logging.warning('null distance between head and tail')
else:
v = v / vnorm
c, s = v / self.average_body_length # scale using the rotation matrix c, s = v / self.average_body_length # scale using the rotation matrix
rot = np.array([[ c, s], rot = np.array([[ c, s],
[-s, c]]) # clockwise rotation [-s, c]]) # clockwise rotation
......
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