inference code sample
Hi Smilingwolf, thanks for your amazing work. I want to deploy this model for inference. Could you please provide a sample code for my reference?
For example:
from huggingface_hub import from_pretrained_keras
import numpy as np
from tensorflow.keras.utils import load_img
model = from_pretrained_keras("SmilingWolf/wd-v1-4-swinv2-tagger-v2")
cat_image = load_img("./aaa.png", target_size=(448, 448))
cat_image_array = np.array(cat_image).reshape((1,448, 448, 3))
prediction = model.predict(cat_image_array)
prediction1 = tf.squeeze(tf.round(prediction))
print(prediction1)
The output from prediction1 is a Tensor list, so how to convert it to tag?Thank you.
tf.Tensor([1. 0. 0. ... 0. 0. 0.], shape=(9083,), dtype=float32)
hey did you figure out how to do the tag mapping ?
I've got a space up that uses the models I release. Here: https://huggingface.co/spaces/SmilingWolf/wd-tagger