Metadata-Version: 2.4
Name: BlyncsySFT
Version: 0.1.1
Summary: Supervised Fine-Tuning Package for Blyncsy
Author-email: Sonny Jones <sonny.jones@utah.edu>, Anthony Le <anthony.le@utah.edu>, Rohit Raj <rohitrraj284@gmail.com>
Maintainer-email: Sonny Jones <sonny.jones@utah.edu>
Classifier: Programming Language :: Python :: 3
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: torch>=2.6.0
Requires-Dist: torchvision>=0.15.0
Requires-Dist: numpy>=1.21.0
Requires-Dist: tqdm>=4.67.1
Requires-Dist: pycocotools>=2.0.8
Requires-Dist: opencv-python>=4.11.0.86
Requires-Dist: click>=8.1.3
Requires-Dist: PyYAML>=6.0
Requires-Dist: scikit-learn>=0.23.2
Requires-Dist: python-dotenv>=1.1.0
Requires-Dist: albumentations>=2.0.5
Requires-Dist: pillow>=9.0.1
Requires-Dist: matplotlib>=3.7.1
Dynamic: license-file

# 📦 BlyncsySFT

**Supervised Fine-Tuning for Faster R-CNN with Focal Loss and Custom Augmentations**  
An extensible training and evaluation framework for object detection on COCO-format datasets.

---

## 🚀 Features

- 🧠 Fine-tuning with Focal Loss for class imbalance
- 🎯 Customizable anchor boxes and backbone networks
- 🧪 Augmentation pipeline (MixUp, transforms, etc.)
- 📊 Validation pipeline with mAP evaluation (COCO)
- 🛠 CLI interface for training automation
- 🗂 Compatible with COCO-style datasets

---

## 📁 Installation

```bash
pip install blyncsysft
```

or

```bash
git clone https://github.com/your-username/BlyncsySFT.git
cd BlyncsySFT
pip install .
```

## 🧩 Quick Start

1. **Prepare your dataset and project structure**: Ensure your dataset is in COCO format. The directory structure should look like this:

    ```pgsql
    your_project/
    ├── images/
    │   ├── train/
    │   └── validation/
    ├── annotations/
    │   ├── train.json
    │   └── validation.json
    └── .env
    ```

2. **Create a `.env` file**: This file should contain the following variables:

    ```bash
    TRAINING_RUN=test01
    EPOCHS=20
    BATCH_SIZE=4
    WORKERS=2
    NUM_CLASSES=2
    BACKBONE=resnet50
    SAVE_EVERY=5
    TRAIN_IMAGE_PATH=images/train
    TRAIN_ANNOT_PATH=annotations/train.json
    VAL_IMAGE_PATH=images/validation
    VAL_ANNOT_PATH=annotations/validation.json
    ```

## 🧪 Usage

Run training directly from the command line:

```bash
python -m BlyncsySFT.cli train /path/to/your_project/ --verbose
```

This command:

- Valdiates your .env file
- Loads the dataset
- Builds and trains the model
- Logs the training process
- Saves the model checkpoints

Or use the Python API:

```python
from BlyncsySFT.pipeline import run_auto_training_pipeline
from BlyncsySFT.config import load_and_validate_env

# Step 1: Load config
cfg = load_and_validate_env(env_file="/path/to/your_project/.env")

# Step 2: Define project directory
project_dir = "/path/to/your_project"

# Step 3: Run the training pipeline
run_auto_training_pipeline(project_dir, cfg, verbose=True)
```

## 📄 License

MIT License. See the [LICENSE](LICENSE) file for details.

## 🤝 Contributing

We welcome contributions! Please follow these steps:

1. Fork the repo and create your branch (`git checkout -b feature/YourFeature`).
2. Make your changes, add tests, and commit them (`git commit -m 'Add some feature'`).
3. Submit a pull request and describe your changes.

## 👥 Contributors

- **Sonny Jones** – [sonny.jones@utah.edu](mailto:sonny.jones@utah.edu)  
- **Tony Le** – [anthony.le@utah.edu](mailto:anthony.le@utah.edu)  
- **Rohit Raj** – [rohitrraj284@gmail.com](mailto:rohitrraj284@gmail.com)
