Instructions to use shoni/comic-sans-detector with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use shoni/comic-sans-detector with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-classification", model="shoni/comic-sans-detector") pipe("https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/hub/parrots.png")# pip install -U transformers accelerate # Load model directly from transformers import AutoImageProcessor, AutoModelForImageClassification processor = AutoImageProcessor.from_pretrained("shoni/comic-sans-detector") model = AutoModelForImageClassification.from_pretrained("shoni/comic-sans-detector", device_map="auto") - Notebooks
- Google Colab
- Kaggle
|
Download README.md from shoni/comic-sans-detector: direct link, hf CLI and curl.
- Browser
- Download file 3.6 kB
-
https://huggingface.co/shoni/comic-sans-detector/resolve/b9b64de45bca68ba6d7fca6642d6c87b1941ca17/README.md
- Command line
-
hf download hf://shoni/comic-sans-detector@b9b64de45bca68ba6d7fca6642d6c87b1941ca17/README.md
-
curl -L -o README.md https://huggingface.co/shoni/comic-sans-detector/resolve/b9b64de45bca68ba6d7fca6642d6c87b1941ca17/README.md
3.6 kB
| language: | |
| - en | |
| tags: | |
| - image-classification | |
| - font-detection | |
| - resnet | |
| - fine-tuning | |
| datasets: | |
| - custom | |
| license: mit | |
| library_name: transformers | |
| base_model: resnet-18 | |
| # Comic Sans Detector | |
| This repository contains a fine-tuned ResNet-18 model, specifically trained to detect whether an image contains Comic Sans font. It is a fine-tuning of a previously fine-tuned font classification model, based on the ResNet-18 foundation model. | |
| ## Features | |
| - Distinguishes between Comic Sans and non-Comic Sans images. | |
| - Built using a custom dataset with two classes: `comic` and `not-comic`. | |
| ## Usage | |
| To use this model with the Hugging Face Inference API: | |
| ```python | |
| from transformers import pipeline | |
| classifier = pipeline("image-classification", model="shoni/comic-sans-detector") | |
| result = classifier("path/to/image.jpg") | |
| print(result) | |
| # Comic Sans Detector | |
| This repository contains a fine-tuned ResNet-18 model, specifically trained to detect whether an image contains Comic Sans font. It is a fine-tuning of a previously fine-tuned font classification model, based on the ResNet-18 foundation model. | |
| ## Repository Contents | |
| - **`comic-detector.ipynb`**: A notebook that demonstrates the training and evaluation process for the Comic Sans detector using the fine-tuned ResNet-18 model. | |
| - **`image-format-generalizer.ipynb`**: A utility notebook for preparing and normalizing image datasets, ensuring consistent formatting across `/data` folders. | |
| ## Dataset Structure (Not Included) | |
| The dataset used for training and evaluation should follow this structure: | |
| ``` | |
| /data | |
| βββ comic/ | |
| β βββ image1.jpg | |
| β βββ image2.png | |
| β βββ ... | |
| βββ not-comic/ | |
| β βββ image1.jpg | |
| β βββ image2.png | |
| β βββ ... | |
| ``` | |
| - **`comic/`**: Contains images labeled as featuring Comic Sans font. | |
| - **`not-comic/`**: Contains images labeled as not featuring Comic Sans font. | |
| β οΈ The dataset itself is not included in this repository. You must prepare and structure your dataset as described. | |
| ## How to Use | |
| ### 1. Clone the Repository | |
| ```bash | |
| git clone https://huggingface.co/your-username/comic-sans-detector | |
| cd comic-sans-detector | |
| ``` | |
| ### 2. Prepare the Dataset | |
| Ensure your dataset is properly structured under a `/data` directory with `comic/` and `not-comic/` folders. | |
| ### 3. Run the Training Notebook | |
| Open `comic-detector.ipynb` in Jupyter Notebook or an equivalent environment to retrain the model or evaluate it. | |
| ### 4. Format Images (Optional) | |
| If your dataset images are not in a consistent format, use `image-format-generalizer.ipynb` to preprocess them. | |
| ## Model Usage | |
| The fine-tuned model can be deployed directly via the Hugging Face Inference API. Once uploaded, the model can be used to classify whether an image contains Comic Sans font. | |
| Example API usage (replace `your-username/comic-sans-detector` with your repository name): | |
| ```python | |
| from transformers import pipeline | |
| classifier = pipeline("image-classification", model="your-username/comic-sans-detector") | |
| result = classifier("path/to/image.jpg") | |
| print(result) | |
| ``` | |
| ## Fine-Tuning Process | |
| This model was fine-tuned on a previously fine-tuned font classification model, which itself was based on the ResNet-18 foundation model. The fine-tuning process was conducted using a custom dataset with two classes: `comic` and `not-comic`. | |
| ## Acknowledgments | |
| This project is based on the original font identifier repository by [gaborcselle](https://huggingface.co/gaborcselle/font-identifier). | |
| ## License | |
| Include your preferred license here (e.g., MIT, Apache 2.0, etc.). | |