Error message during .supervised_annotation() fucntion
Hi Lucas,
We are running into the following error message with the newest gitlab version of DeepOF (a452c208).
We are training "B" and "W" animals, in a automated detection arena. And everything runs smoothly until:
rule_based_annot_SI1 = my_project_SI1.supervised_annotation()
0%| | 0/10 [00:03<?, ?it/s]
AttributeError Traceback (most recent call last) Input In [6], in <cell line: 4>() 1 #rule_based_annot_SI1 = my_project_SI1.supervised_annotation(video_output="all", frame_limit=150, debug=True) 2 3 #rule_based_annot_SI2 = my_project_SI2.supervised_annotation(video_output="all", frame_limit=150, debug=True) ----> 4 rule_based_annot_SI1 = my_project_SI1.supervised_annotation() 5 rule_based_annot_SI2 = my_project_SI2.supervised_annotation()
File ~\deepof\deepof\data.py:1125, in Coordinates.supervised_annotation(self, params, video_output, frame_limit, debug, n_jobs, propagate_labels) 1121 for key in tqdm(self._tables.keys()): 1122 # Remove indices and add at the very end, to avoid conflicts if 1123 # frame_rate is specified in project 1124 tag_index = raw_coords[key].index -> 1125 supervised_tags = deepof.supervised_utils.supervised_tagging( 1126 self, 1127 raw_coords=raw_coords, 1128 coords=coords, 1129 dists=dists, 1130 angs=angs, 1131 speeds=speeds, 1132 video=[vid for vid in self._videos if key + "DLC" in vid][0], 1133 trained_model_path=self._trained_model_path, 1134 params=params, 1135 ) 1136 supervised_tags.index = tag_index 1137 tag_dict[key] = supervised_tags
File ~\deepof\deepof\supervised_utils.py:713, in supervised_tagging(coord_object, raw_coords, coords, dists, angs, speeds, video, trained_model_path, params) 691 tag_dict[_id + undercond + "climbing"] = deepof.utils.smooth_boolean_array( 692 climb_wall( 693 arena_type, (...) 698 ) 699 ) 700 tag_dict[_id + undercond + "sniffing"] = deepof.utils.smooth_boolean_array( 701 sniff_object( 702 speeds, (...) 711 ) 712 ) --> 713 tag_dict[_id + undercond + "huddle"] = huddle( 714 coords.loc[ # Filter coordinates to keep only the current animal 715 :, 716 [ 717 col 718 for col in coords.columns 719 if col in deepof.utils.filter_columns(coords.columns, _id) 720 ], 721 ], 722 speeds.loc[ # Filter speeds to keep only the current animal 723 :, 724 [ 725 col 726 for col in speeds.columns 727 if col in deepof.utils.filter_columns(speeds.columns, _id) 728 ], 729 ], 730 huddle_estimator, 731 ) 732 tag_dict[_id + undercond + "dig"] = dig( 733 coords.loc[ # Filter coordinates to keep only the current animal 734 :, (...) 749 dig_estimator, 750 ) 751 tag_dict[_id + undercond + "lookaround"] = deepof.utils.smooth_boolean_array( 752 look_around( 753 speeds, (...) 758 ) 759 )
File ~\deepof\deepof\supervised_utils.py:305, in huddle(pos_dframe, speed_dframe, huddle_estimator) 303 # Concatenate all relevant data frames and predict using the pre-trained estimator 304 X_huddle = pd.concat([pos_dframe, speed_dframe], axis=1).to_numpy() --> 305 y_huddle = huddle_estimator.predict(X_huddle) 307 return y_huddle
File ~.conda\envs\deepof\lib\site-packages\sklearn\pipeline.py:458, in Pipeline.predict(self, X, **predict_params) 456 for _, name, transform in self._iter(with_final=False): 457 Xt = transform.transform(Xt) --> 458 return self.steps[-1][1].predict(Xt, **predict_params)
File ~.conda\envs\deepof\lib\site-packages\sklearn\ensemble_gb.py:1449, in GradientBoostingClassifier.predict(self, X) 1434 def predict(self, X): 1435 """Predict class for X. 1436 1437 Parameters (...) 1447 The predicted values. 1448 """ -> 1449 raw_predictions = self.decision_function(X) 1450 encoded_labels = self._loss.raw_prediction_to_decision(raw_predictions) 1451 return self.classes.take(encoded_labels, axis=0)
File ~.conda\envs\deepof\lib\site-packages\sklearn\ensemble_gb.py:1405, in GradientBoostingClassifier.decision_function(self, X)
1384 """Compute the decision function of X
.
1385
1386 Parameters
(...)
1400 array of shape (n_samples,).
1401 """
1402 X = self._validate_data(
1403 X, dtype=DTYPE, order="C", accept_sparse="csr", reset=False
1404 )
-> 1405 raw_predictions = self._raw_predict(X)
1406 if raw_predictions.shape[1] == 1:
1407 return raw_predictions.ravel()
File ~.conda\envs\deepof\lib\site-packages\sklearn\ensemble_gb.py:817, in BaseGradientBoosting._raw_predict(self, X) 815 def _raw_predict(self, X): 816 """Return the sum of the trees raw predictions (+ init estimator).""" --> 817 raw_predictions = self.raw_predict_init(X) 818 predict_stages(self.estimators, X, self.learning_rate, raw_predictions) 819 return raw_predictions
File ~.conda\envs\deepof\lib\site-packages\sklearn\ensemble_gb.py:810, in BaseGradientBoosting._raw_predict_init(self, X) 806 raw_predictions = np.zeros( 807 shape=(X.shape[0], self._loss.K), dtype=np.float64 808 ) 809 else: --> 810 raw_predictions = self.loss.get_init_raw_predictions(X, self.init).astype( 811 np.float64 812 ) 813 return raw_predictions
AttributeError: 'GradientBoostingClassifier' object has no attribute '_loss'