Okay, you have a number of checkpoints from a train-loop for 100500 epochs. Or you’ve carried some experiments with one architecture and changed only global parameters and now you have 7 saved .pth models in your folder.

But all of these models still can’t achieve 90% accuracy … 0.5–0.7% are missing.

Then how to reach the desired accuracy of 90%? The answer is to combine all models & average weights from snapshots.


Get a dictionary for each snapshot: parameters’ names and values.

for snapshot_path in list_of_snapshots_paths:
model = load_net(path=snapshot_path)
snapshots_weights[snapshot_path] =

Iterate on each parameter and set in new state_dict averaged value.

custom_params += snapshot_params[name].data        dict_params[name].data.copy_(custom_params/N)

Load new state_dict into the model.

model_dict = model.state_dict()

“Fight detection”, “sport exercises recognition”, “body VR”… Recently, the number of references to these phrases has increased in articles, scientific paper abstracts, and posts on Linkedin. All these things are based on one interesting problem in the field of Computer Vision — Pose Estimation.

The main goal of Pose Estimation is to detect keypoints of the human body.

(Photo taken from Pexels)

You can read more about the Pose Estimation tasks in other articles on Medium or in numerous resources on the Internet.


Metrics exist to evaluate machine learning models and calculate the performance value of an algorithm. Metrics logic is very simple for…

Alexander Stasiuk

Computer Vision Engineer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store