The WD 1.4 SwinV2 Tagger V2 is an advanced model designed for tagging images with related ratings, characters, and general tags. It leverages the power of deep learning and is trained on the Danbooru dataset, giving it a keen understanding of various image characteristics. In this article, we will guide you through the steps to set up and use this image tagging model effectively.
Setting Up the WD 1.4 SwinV2 Tagger V2
Before diving into the tagging functionalities, you need to set up the necessary environment and dependencies.
- Ensure you have the ONNX Runtime version at least 1.17.0. This is crucial for running the model smoothly.
- Retrieve the pre-trained model from the repository: GitHub – SmilingWolf SW-CV-ModelZoo.
- Including any necessary libraries like JAX-CV for further integration and functionality.
Understanding the Dataset
The model is trained on images from the Danbooru dataset, specifically focusing on images with IDs filtered for relevance.
- The last image ID used for training is 5944504.
- Images are selected based on a filtering routine:
- Only images with IDs modulo 0000-0899 were used for training.
- Validation was conducted using images with IDs modulo 0950-0999.
- Images with fewer than 10 general tags were eliminated.
- Tags associated with fewer than 600 images were also filtered out.
Using the Model for Tagging
Now that you have set up the model, it’s time to put it to work. You can load the model using a simple one-liner:
model = load_model('path/to/your/model.onnx')
This loading procedure is enabled by the recent updates that have made the model compatible with various frameworks, enhancing your ability to perform batch inference, which can significantly speed up the process when dealing with large sets of images.
Validation Results
Key metrics from the validation process of the model are as follows:
- Precision = Recall = Threshold = 0.3771
- F1 Score = 0.6854
Troubleshooting Common Issues
While the model is designed to operate smoothly, you may encounter some issues. Here are potential solutions:
- Model Not Loading: Ensure the ONNX Runtime version is compatible. Update to ensure it meets the minimum requirement of 1.17.0.
- Incorrect Predictions: Consider that there might be slight discrepancies in predictions across different frameworks due to implementation differences. If issues persist, check your input data for compliance with the filtering criteria mentioned above.
- Batch Dimension Issues: Ensure you are not fixing the batch dimension to 1 in your inputs, as it may affect performance with larger datasets. The model now allows batch sizes to be flexible.
For more insights, updates, or to collaborate on AI development projects, stay connected with fxis.ai.
Final Thoughts
This model is subject to ongoing updates, so it is advisable to use tagged releases rather than relying on the latest commits from the repository to avoid unexpected changes.
At fxis.ai, we believe that such advancements are crucial for the future of AI, as they enable more comprehensive and effective solutions. Our team is continually exploring new methodologies to push the envelope in artificial intelligence, ensuring that our clients benefit from the latest technological innovations.

