From 3b0bd60c47d853262dbc4c8dd6f708084a347933 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?O=C4=9Fuzhan=20B=C3=BCy=C3=BCksolak?= Date: Thu, 16 May 2024 23:20:05 +0300 Subject: [PATCH] Checkpoint check for dimensionality reduction; remove imutils import (#301) --- requirements.txt | 1 - scripts/train_faceid_112.sh | 6 +++++- scripts/train_mobilefacenet_112.sh | 6 +++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/requirements.txt b/requirements.txt index aa5726440..dbf6502ac 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,7 +8,6 @@ albumentations>=1.3.0 faiss-cpu==1.7.4 face-detection==0.2.2 h5py>=3.7.0 -imutils==0.5.4 kornia==0.6.8 librosa>=0.7.2 numba<0.50.0 diff --git a/scripts/train_faceid_112.sh b/scripts/train_faceid_112.sh index ef54f1b7c..f3e73daad 100755 --- a/scripts/train_faceid_112.sh +++ b/scripts/train_faceid_112.sh @@ -1,3 +1,7 @@ #!/bin/sh -python train.py --epochs 4 --optimizer Adam --lr 0.001 --scaf-lr 1e-2 --scaf-scale 32 --copy-output-folder pretrained/ir152_dim64 --wd 5e-4 --deterministic --workers 8 --qat-policy None --model ir_152 --dr 64 --backbone-checkpoint pretrained/Backbone_IR_152_Epoch_112_Batch_2547328_Time_2019-07-13-02-59_checkpoint.pth --use-bias --dataset VGGFace2_FaceID_dr --batch-size 64 --device MAX78000 --validation-split 0 --print-freq 250 "$@" || exit 1 +if [ -f "pretrained/ir152_dim64/best.pth.tar" ]; then + echo "Skipping the dimensionality reduction command as pretrained/ir152_dim64/best.pth.tar already exists." +else + python train.py --epochs 4 --optimizer Adam --lr 0.001 --scaf-lr 1e-2 --scaf-scale 32 --copy-output-folder pretrained/ir152_dim64 --wd 5e-4 --deterministic --workers 8 --qat-policy None --model ir_152 --dr 64 --backbone-checkpoint pretrained/Backbone_IR_152_Epoch_112_Batch_2547328_Time_2019-07-13-02-59_checkpoint.pth --use-bias --dataset VGGFace2_FaceID_dr --batch-size 64 --device MAX78000 --validation-split 0 --print-freq 250 "$@" || exit 1 +fi python train.py --epochs 80 --optimizer Adam --lr 0.001 --compress policies/schedule-faceid_112.yaml --kd-student-wt 0 --kd-distill-wt 1 --qat-policy policies/qat_policy_faceid_112.yaml --model ai85faceidnet_112 --kd-teacher ir_152 --kd-resume pretrained/ir152_dim64/best.pth.tar --kd-relationbased --wd 0 --deterministic --workers 8 --use-bias --dataset VGGFace2_FaceID --batch-size 256 --device MAX78000 --print-freq 100 --validation-split 0 "$@" diff --git a/scripts/train_mobilefacenet_112.sh b/scripts/train_mobilefacenet_112.sh index a00fe7c69..a22c01a63 100755 --- a/scripts/train_mobilefacenet_112.sh +++ b/scripts/train_mobilefacenet_112.sh @@ -1,3 +1,7 @@ #!/bin/sh -python train.py --epochs 4 --optimizer Adam --lr 0.001 --scaf-lr 1e-2 --scaf-scale 32 --copy-output-folder pretrained/ir152_dim64 --wd 5e-4 --deterministic --workers 8 --qat-policy None --model ir_152 --dr 64 --backbone-checkpoint pretrained/Backbone_IR_152_Epoch_112_Batch_2547328_Time_2019-07-13-02-59_checkpoint.pth --use-bias --dataset VGGFace2_FaceID_dr --batch-size 64 --device MAX78000 --validation-split 0 --print-freq 250 "$@" || exit 1 +if [ -f "pretrained/ir152_dim64/best.pth.tar" ]; then + echo "Skipping the dimensionality reduction command as pretrained/ir152_dim64/best.pth.tar already exists." +else + python train.py --epochs 4 --optimizer Adam --lr 0.001 --scaf-lr 1e-2 --scaf-scale 32 --copy-output-folder pretrained/ir152_dim64 --wd 5e-4 --deterministic --workers 8 --qat-policy None --model ir_152 --dr 64 --backbone-checkpoint pretrained/Backbone_IR_152_Epoch_112_Batch_2547328_Time_2019-07-13-02-59_checkpoint.pth --use-bias --dataset VGGFace2_FaceID_dr --batch-size 64 --device MAX78000 --validation-split 0 --print-freq 250 "$@" || exit 1 +fi python train.py --epochs 35 --optimizer Adam --lr 0.001 --compress policies/schedule-mobilefacenet_112.yaml --kd-student-wt 0 --kd-distill-wt 1 --qat-policy policies/qat_policy_mobilefacenet_112.yaml --model ai87netmobilefacenet_112 --kd-teacher ir_152 --kd-resume pretrained/ir152_dim64/best.pth.tar --kd-relationbased --wd 0 --deterministic --workers 8 --use-bias --dataset VGGFace2_FaceID --batch-size 100 --device MAX78002 --validation-split 0 --print-freq 100 "$@"