
# 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/shoni/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 `shoni/comic-sans-detector` with your repository name):
```python
from transformers import pipeline

classifier = pipeline("image-classification", model="shoni/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.).

comic not-comic