-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
edge case fix / rc10 #3036
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
edge case fix / rc10 #3036
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -626,6 +626,7 @@ def evaluate_snapshot( | |
| ) | ||
| scores_filepath = output_filename.with_suffix(".csv") | ||
| scores_filepath = scores_filepath.with_stem(scores_filepath.stem + "-results") | ||
| print(f"Evaluation results file: {scores_filepath.name}") | ||
| save_evaluation_results(df_scores, scores_filepath, show_errors, pcutoff) | ||
|
|
||
| if per_keypoint_evaluation: | ||
|
|
@@ -829,6 +830,7 @@ def evaluate_network( | |
| snapshot_uid=get_scorer_uid(snapshot, detector_snapshot), | ||
| modelprefix=modelprefix, | ||
| ) | ||
| print(f"Evaluation scorer: {scorer}") | ||
|
||
| evaluate_snapshot( | ||
| loader=loader, | ||
| cfg=cfg, | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -449,9 +449,58 @@ def analyze_videos( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| print(f"Creating a TopDownDynamicCropper with configuration {top_down_dynamic}") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| print(f"Creating a TopDownDynamicCropper with configuration {top_down_dynamic}") | |
| logging.info(f"Creating a TopDownDynamicCropper with configuration {top_down_dynamic}") |
Copilot
AI
Jul 1, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Using print statements for error reporting may limit flexibility; consider using a logging framework that allows configurable log levels and better integration in production.
| print(f"Error loading snapshot with index {snapshot_index}: {e}") | |
| print("Attempting to find available snapshots...") | |
| logging.error(f"Error loading snapshot with index {snapshot_index}: {e}") | |
| logging.info("Attempting to find available snapshots...") |
Copilot
AI
Jul 1, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Consider refactoring the repeated error handling logic for loading snapshots into a helper function to reduce code duplication and improve maintainability.
| try: | |
| snapshot = utils.get_model_snapshots( | |
| snapshot_index, loader.model_folder, loader.pose_task | |
| )[0] | |
| except (ValueError, IndexError) as e: | |
| print(f"Error loading snapshot with index {snapshot_index}: {e}") | |
| print("Attempting to find available snapshots...") | |
| # Try to get all available snapshots | |
| try: | |
| all_snapshots = utils.get_model_snapshots("all", loader.model_folder, loader.pose_task) | |
| if all_snapshots: | |
| # Try to find a "best" snapshot first | |
| best_snapshots = [s for s in all_snapshots if s.best] | |
| if best_snapshots: | |
| snapshot = best_snapshots[0] | |
| print(f"Found and using best snapshot: {snapshot.path}") | |
| else: | |
| # Use the last available snapshot | |
| snapshot = all_snapshots[-1] | |
| print(f"No best snapshot found, using last available: {snapshot.path}") | |
| else: | |
| raise FileNotFoundError(f"No snapshots found in {loader.model_folder}") | |
| except Exception as fallback_error: | |
| raise FileNotFoundError(f"Failed to load any snapshots from {loader.model_folder}. Original error: {e}. Fallback error: {fallback_error}") | |
| snapshot = load_snapshot_with_fallback( | |
| snapshot_index, loader.model_folder, loader.pose_task | |
| ) |
Copilot
AI
Jul 1, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Refactor the duplicated fallback logic for snapshot retrieval into a shared helper function to reduce code duplication and enhance maintainability.
Copilot
AI
Jul 1, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] The error handling logic for detector snapshot loading is almost identical to that for the model snapshot; consider abstracting this logic into a shared function to reduce duplication.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| pip uninstall deeplabcut | ||
| python3 setup.py sdist bdist_wheel | ||
| pip install dist/deeplabcut-3.0.0rc9-py3-none-any.whl | ||
| pip install dist/deeplabcut-3.0.0rc10-py3-none-any.whl |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Consider replacing print statements with a logging framework to allow for configurable and consistent output handling across the codebase.