| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
…anager to save best snapshot.
There was a problem hiding this comment.
Beside the variable names in the pytorch_config.md, this looks good to me!
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Many minor improvements to the user experience when training models. Overview of changes (see below for description of each change):
Fixes
Patch pycocotools printing during bounding box evaluation
Evaluating object detection performance with pycocotools led to useless/confusing lines being printed:
The print functions inside of pycocotools have been patched so these lines are no longer printed.
Same mAP scale for pose and object detection metrics
Object detection mAP was reported between 0 and 1 (the default though pycocotools), while pose mAP was reported between 0 and 100. Both bounding box mAP and pose mAP is now reported between 0 and 100.
Typing fixes
When calling train_network, both snapshot_path and detector_path can be strings, paths or None.
Logging to learning_stats.csv
Both detector and pose model stats were logged to learning_stats.csv, so one would overwrite the other. This is no longer the case, with pose model stats logged to learning_stats.csv and detector stats are logged to learning_stats_detector.csv.
Non-zero starting epoch
When continuing to train a model, if the epochs given were larger than the starting epoch (the number of epochs for which the given weights were trained), the model was only trained for epochs - starting_epochs. So in the example below, the 2nd call to train_network would only train for 5 extra epochs. This was so the model is always trained for the number of epochs passed as an argument (so that in the example below, the model would be trained for 10 extra epochs and the last snapshots output would be snapshot-015.pt and snapshot-detector -015.pt)
Detector training - evaluation loss
Torchvision object detection models cannot return both loss and predictions: it's one or the other. When evaluating during training, the predictions are used to obtain mAP/mAR metrics, so the loss is nan. To avoid any confusion, the validation loss (which is NaN as we don't have it) is no longer printed.
Printing metrics during training
Some visual improvements were made when logging metrics to the console during training.
When training detectors:
When training pose estimation models:
Saving the best snapshot
Addresses #2663 to save the best snapshot during training. The best snapshot will be saved as snapshot-best-XYZ.pt, where XYZ is the number of epochs for which it was trained.
Resuming Training from a Given Snapshot
Adds an option to the pytorch_config.yaml to resume training from an existing snapshot, with:
Fix PAF predictor running on MPS
The PAF predictor would fail when running on MPS (macOS GPU), as torch.round(...) is not yet implemented. An easy fix was to run scripts with PYTORCH_ENABLE_MPS_FALLBACK=1 set as an environment variable. This changes the operation to run with numpy so this fix is no longer needed.
Multi-GPU training: fix saving the state dict
Addresses issue #2749.