You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<!-- Make sure 'assets/Banner.png' exists in your project or update the path -->
3
4
</p>
4
5
5
6
# 🌟 ScaleX: AI Face Restoration & Enhancement CLI
6
7
7
8
ScaleX is a powerful command-line tool for enhancing and restoring faces in images using advanced AI. Built on the robust foundations of GFPGAN and Real-ESRGAN, ScaleX has been modernized for Python 3.12, features a user-friendly interactive CLI, and includes smarts for easier setup and smoother operation.
8
9
10
+
<!-- Optional: Add a before/after image or a short demo GIF -->
11
+
<!--
12
+
<p align="center">
13
+
<img src="assets/scalex_before_after_example.png" width="70%" alt="ScaleX Before and After">
ScaleX brings cutting-edge AI face restoration to your command line. Whether you're dealing with old family photos, blurry portraits, or low-resolution images, ScaleX aims to revitalize them with remarkable clarity and detail. It intelligently combines face-specific enhancement using **GFPGAN** models with optional background upscaling via **Real-ESRGAN**.
22
37
38
+
This project focuses on delivering a refined and accessible experience by:
39
+
40
+
- Upgrading the core to **Python 3.12**.
41
+
- Providing an **enhanced CLI** with clear options and rich progress feedback (thanks to Typer and Rich).
42
+
- Automating fixes for common **dependency issues**.
43
+
- Streamlining **model downloads** with user-friendly progress bars.
- 📈 **Overall Image Upscaling:** Control the final output resolution (e.g., 2x, 4x).
@@ -38,96 +61,159 @@ ScaleX brings cutting-edge AI face restoration to your command line. Whether you
38
61
---
39
62
40
63
## 🛠️ Installation
64
+
41
65
### 📋 Prerequisites
66
+
42
67
- 🐍 [Python](https://www.python.org/) 3.12
43
-
- 🐉 [Anaconda](https://www.anaconda.com/download) or [Miniconda](https://docs.conda.io/projects/conda/en/stable/user-guide/install/index.html) (Recommended for PyTorch)
- 🐉 [Anaconda](https://www.anaconda.com/download) or [Miniconda](https://docs.conda.io/projects/conda/en/stable/user-guide/install/index.html) (Required for the automated installation scripts and recommended for PyTorch)
69
+
- ➕ [Git](https://git-scm.com/) (To clone the repository)
47
70
- ❗ **For GPU Acceleration (Optional but Recommended):**
Visit the [PyTorch official website](https://pytorch.org/get-started/locally/) to get the correct installation commandfor your system (OS, package manager, CUDA version if applicable).
118
+
3. **Install PyTorch:**
119
+
Visit the [PyTorch official website](https://pytorch.org/get-started/locally/) to get the correct `conda install`commandfor your system (OS, package manager, CUDA version if applicable).
*(Adjust the CUDA version as needed for your setup)*
75
132
76
-
4. **Install Dependencies**
133
+
_(Adjust the CUDA version as needed for your setup)_
134
+
135
+
4. **Install Dependencies:**
77
136
```bash
78
137
pip install -r requirements.txt
79
138
```
80
139
81
-
5. **Model Downloads**
82
-
🚀 *Required models (GFPGAN, Real-ESRGAN, facexlib components) will be automatically downloaded with a progress bar when you run the application forthe first time if they are not foundin the `models/pretrained/` directory.*
140
+
5. **Model Downloads:**
141
+
🚀 _Required models (GFPGAN, Real-ESRGAN, facexlib components) will be automatically downloaded with a progress bar when you run the application forthe first time if they are not foundin the `models/pretrained/` directory._
83
142
84
143
---
85
144
86
145
## 💻 Usage
146
+
87
147
### ▶️ Running ScaleX
88
-
Navigate to the `ScaleX` directory in your terminal (ensure your `ScaleX` conda environment is activated).
89
-
The main script is `inference_scalex.py`.
148
+
149
+
After successful installation:
150
+
151
+
1. Open your terminal or Anaconda Prompt.
152
+
2. Activate the Conda environment: `conda activate ScaleX-CLI`
To process all images in a folder named `MyPhotos` and save results to `EnhancedPhotos`, using GFPGAN v1.4, RealESRGAN x4 for background, and upscaling the final image by 4x:
*`--aligned`: Use this if your input images are already 512x512 aligned faces.
182
+
*`--ext [auto|png|jpg]`: Extension for saved output images. (Default: `auto`)
116
183
*`--no-save-cropped`: Do not save the initial cropped faces.
117
184
*`--no-save-restored`: Do not save the individually restored faces.
118
185
*`--no-save-comparison`: Do not save the side-by-side comparison images.
119
186
120
-
**Get Help:**
121
-
For a full list of all available options and their descriptions:
187
+
**Get Full Help:**
188
+
For a comprehensive list of all available options and their descriptions:
122
189
```bash
123
190
python inference_scalex.py --help
124
-
```
191
+
````
192
+
193
+
---
194
+
195
+
## 💡 Troubleshooting
196
+
197
+
- **`ModuleNotFoundError: No module named 'torchvision.transforms.functional_tensor'`**:
198
+
ScaleX includes an automated patch (`patches.py`) for this common `basicsr`/`torchvision` issue. It should be applied automatically. If you see this, ensure `patches.py` is present and correctly imported at the start of `inference_scalex.py`.
199
+
- **Model Download Issues**:
200
+
- Check your internet connection.
201
+
- If a download seems stuck or corrupt, try deleting the specific `.pth` file from the `models/pretrained/` directory within your ScaleX project folder and re-run.
202
+
- **GPU (CUDA / MPS) Errors**:
203
+
- **NVIDIA CUDA:** Ensure your NVIDIA drivers are up-to-date and that you installed the PyTorch version matching your system's CUDA toolkit version.
204
+
- **Apple MPS:** Ensure you are on a compatible macOS and PyTorch version.
205
+
- Test with `--device cpu` to isolate if the problem is GPU-specific.
206
+
- **Installation Script Issues**:
207
+
- Ensure Conda is installed and its `bin` or `Scripts` directory is in your system's PATH, or that Conda has been initialized for your shell (e.g., via `conda init bash` or `conda init cmd.exe`).
208
+
- **Other `ModuleNotFoundError`s**:
209
+
Make sure you have activated the correct conda environment (`conda activate ScaleX-CLI`) and that all packages from `requirements.txt` were installed successfully.
125
210
126
211
---
127
212
128
213
## 🤝 Contributing
214
+
129
215
🎉 Contributions, issues, and feature requests are welcome!
130
-
Feel free to check [issues page](https://github.com/[YourGitHubUsername]/ScaleX/issues). You can also fork the repository and submit a pull request.
216
+
Feel free to check the [issues page](https://github.com/Md-Siam-Mia-Code/ScaleX-CLI/issues). You can also fork the repository and submit a pull request.
131
217
132
218
1. Fork the Project
133
219
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
@@ -138,15 +224,18 @@ Feel free to check [issues page](https://github.com/[YourGitHubUsername]/ScaleX/
138
224
---
139
225
140
226
## 📜 Acknowledgments & License
227
+
141
228
ScaleX is built upon and inspired by the incredible work of the open-source community. Special thanks to the creators and maintainers of:
0 commit comments