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
adjust num_epochs
(more is better but takes longer)
run playingcards_training.py
training state will be saved to playingcards_trainstate.pt
run playingcards_classify.py <IMAGEFILE>
example output:
training on the M2 macbook:
cpu: 875 sec per epoch
mps: 47 sec per epoch
mps is ≈18 times faster than cpu.