Skip to content

Wrong normalization values #18

@yoav32134

Description

@yoav32134

In vit.cpp, within the function vit_image_preprocess_bicubic, he normalization values are currently set to:

const float m3[3] = {123.675f, 116.280f, 103.530f};
const float s3[3] = {58.395f, 57.120f, 57.375f};

However, for the model vit_tiny_patch16_384.augreg_in21k_ft_in1k (the one referenced in the README), the expected normalization is mean = (0.5, 0.5, 0.5) and std = (0.5, 0.5, 0.5). When operating on a 0–255 scale, this corresponds to:

const float m3[3] = {127.5f, 127.5f, 127.5f};
const float s3[3] = {127.5f, 127.5f, 127.5f};

After changing these values, accuracy improved. I recommend changing it

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions