STEFANN: Scene Text Editor using Font Adaptive Neural Network

Apr 25, 2023 | Data Science





Getting Started   •  
Training Networks   •  
External Links   •  
Citation   •  
License

The Official GitHub Repository for STEFANN: Scene Text Editor using Font Adaptive Neural Network

## Getting Started

### 1. Installing Dependencies

Before you can dive into the functionalities of STEFANN, you’ll need to install some software dependencies. Think of it like setting the stage before a theatrical performance; you need all the props ready for the show to go on!

| Package | Source | Version | Tested Version |
|—————-|——–|———-|—————-|
| Python | Conda | 3.7.7 | ✔️ |
| Pip | Conda | 20.0.2 | ✔️ |
| Numpy | Conda | 1.18.1 | ✔️ |
| Requests | Conda | 2.23.0 | ✔️ |
| TensorFlow | Conda | 2.1.0 | ✔️ |
| Keras | Conda | 2.3.1 | ✔️ |
| Pillow | Conda | 7.0.0 | ✔️ |
| Colorama | Conda | 0.4.3 | ✔️ |
| OpenCV | PyPI | 4.2.0 | ✔️ |
| PyQt5 | PyPI | 5.14.2 | ✔️ |

### 🚀 Quick Installation

#### Step 1: Install [Git](https://git-scm.com) and [Conda](https://docs.conda.io) Package Manager (Miniconda/Anaconda)

#### Step 2: Update and Configure Conda
“`bash
conda update conda
conda config –set env_prompt (name)
“`

#### Step 3: Clone this Repository
“`bash
git clone https://github.com/prasunroy/stefann.git
cd stefann
“`

#### Step 4: Create an Environment and Install Dependencies

– For **CPU** Environment (Linux & Windows):
“`bash
conda env create -f releaseenv_cpu.yml
“`

– For **GPU** Environment (Linux & Windows):
“`bash
conda env create -f releaseenv_gpu.yml
“`

– For **CPU** Environment (macOS):
“`bash
conda env create -f releaseenv_osx.yml
“`

### 🚀 Quick Test

#### Step 1: [Download](https://drive.google.com/open?id=16-mq3MOR1zmOsxNgegRmGDeVRyeyQ0_H) Models and Pretrained Checkpoints into `release/models` Directory

#### Step 2: [Download](https://drive.google.com/uc?export=download&id=1Gzb-VYeQJNXwDnkoEI4iAskOGYmWR6Rk) Sample Images and Extract into `release/sample_images` Directory

Structure:
“`
stefann
└── release
├── models
│ ├── colornet.json
│ ├── colornet_weights.h5
│ ├── fannet.json
│ └── fannet_weights.h5
└── sample_images
├── 01.jpg
└── 02.jpg
“`

#### Step 3: Activate Environment

– To Activate **CPU** Environment:
“`bash
conda activate stefann-cpu
“`

– To Activate **GPU** Environment:
“`bash
conda activate stefann-gpu
“`

#### Step 4: Change Directory to Release and Run STEFANN
“`bash
cd release
python stefann.py
“`

## Editing Results

![Editing Results](https://raw.githubusercontent.com/prasunroy/stefann/master/docs/static/imgs/results.jpg)

Each image pair consists of the original image (Left) and the edited image (Right).

## Training Networks

### 1. Downloading Datasets

#### [Download](https://drive.google.com/open?id=1dOl4_yk2x-LTHwgKBykxHQpmqDvqlkab) Datasets and Extract Archives into `datasets` Directory

The datasets are structured like a library, where each directory serves as a section arranged by themes; in this case, fonts. You have datasets for both **FANnet** and **ColorNet**, each with organized directories for training and validation.

### 2. Training FANnet and Colornet

– **Step 1:** Activate Environment (as mentioned before).

– **Step 2:** Change Directory to Project Root:
“`bash
cd stefann
“`

– **Step 3:** Configure and Train FANnet
Edit the training options in the `fannet.py` file and run:
“`bash
python fannet.py
“`

– **Step 4:** Configure and Train Colornet
Edit the training options in the `colornet.py` file and run:
“`bash
python colornet.py
“`

## External Links

Project   •  
Paper   •  
Supplementary Materials   •  
Datasets   •  
Models   •  
Sample Images

## Troubleshooting

While you’re setting up STEFANN, you may run into a few hiccups. Here are some common troubleshooting tips:

– **Dependency Issues:** Ensure that your Conda environment was created correctly and that all dependencies are installed without error.

– **Activation Problems:** If the environment activation command doesn’t work, check that you installed Conda correctly and that it’s in your system’s PATH.

– **Model Not Found:** Make sure that the model and sample image files are placed in their correct directories as specified.

For more insights, updates, or to collaborate on AI development projects, stay connected with **[fxis.ai](https://fxis.ai)**.

At **[fxis.ai](https://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.

Stay Informed with the Newest F(x) Insights and Blogs

Tech News and Blog Highlights, Straight to Your Inbox