peteryuX / arcface-tf2

ArcFace unofficial Implemented in Tensorflow 2.0+ (ResNet50, MobileNetV2). "ArcFace: Additive Angular Margin Loss for Deep Face Recognition" Published in CVPR 2019. With Colab.
MIT License
260 stars 60 forks source link

Can anyone explain why model loading fails when I try 'archead' while it works with 'normhead' during custom training with16 classes #27

Open lastsupper108 opened 3 years ago

lastsupper108 commented 3 years ago

ValueError: Shapes (512, 16) and (512, 85742) are incompatible

KiLJ4EdeN commented 3 years ago

Hello, it d be nice to provide a better traceback with some of the code, still the problem seems to be the classification layer where the original dataset is supposed to have 85742 unique classes, whereas yours only has 16, you might need to change that manually in the last layer.

soniamaitieo commented 3 years ago

Hello ! I have the same problem, I want to use my own mini CASIA face dataset (with 91 classes ) for training and I have the same error, I don't know where to change it manually in the code ? I just change the ./configs/arc_res50.yaml file like this:

# general
batch_size: 128
input_size: 112
embd_shape: 512
sub_name: 'arc_res50'
backbone_type: 'ResNet50' # 'ResNet50', 'MobileNetV2'
head_type: ArcHead # 'ArcHead', 'NormHead'
is_ccrop: False # central-cropping or not

# train
train_dataset: './data/CASIA.tfrecord'
binary_img: True
num_classes: 91
num_samples: 14088
epochs: 5
base_lr: 0.0001
w_decay: !!float 5e-4
save_steps: 1000

# test
test_dataset: './data/CASIA_test.tfrecord'

Can I have any help please ? (and thank you for the implementation of Arcface for TF2 , it's a good job ^_^)