Skip to content

a bare-bones machine learning example using pytorch on apple silicon hardware

Notifications You must be signed in to change notification settings

haalven/nn-playingcards

Repository files navigation

nn-playingcards

classify images using pytorch on apple silicon hardware.

required: pytorch incl. torchvision, timm and mpl.

pip3 install torch torchvision timm matplotlib

download the playingcards here and adjust cards_folder accordingly

training

adjust num_epochs (more is better but takes longer)

run playingcards_training.py

training state will be saved to playingcards_trainstate.pt

test image

run playingcards_classify.py <IMAGEFILE>

example output:

Image

performance

training on the M2 macbook:

cpu: 875 sec per epoch

mps: 47 sec per epoch

mps is ≈18 times faster than cpu.

About

a bare-bones machine learning example using pytorch on apple silicon hardware

Topics

Resources

Stars

Watchers

Forks

Languages