--- library_name: tflite pipeline_tag: image-classification tags: - image-classification - tflite - tensorflow - gender-classification base_model: rizvandwiki/gender-classification-2 --- # Gender classification (TensorFlow / TFLite) TensorFlow and TFLite conversion of [rizvandwiki/gender-classification-2](https://huggingface.co/rizvandwiki/gender-classification-2) (ViT). Please check the original model card for license and training details. ## Files - `gender_model.tflite` : mobile model (float16) - `tf_model.h5` : TensorFlow (Keras) weights - `labels.txt` : 0 = female, 1 = male ## Input / preprocessing - Shape: `[1, 3, 224, 224]` (channels first, RGB) - Normalize: `(pixel / 255 - 0.5) / 0.5` - Detect and crop the face before running the model. - Output: 2 logits -> apply softmax. Note: converted with SELECT_TF_OPS, so on Android add `org.tensorflow:tensorflow-lite-select-tf-ops`. ## Python example ```python import numpy as np, tensorflow as tf from huggingface_hub import hf_hub_download path = hf_hub_download("SynthAIzer/gender-classification-tflite", "gender_model.tflite") interp = tf.lite.Interpreter(model_path=path) interp.allocate_tensors() ```