Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
215 changes: 215 additions & 0 deletions CODEBASE_INDEX.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,215 @@
# newFastReID Codebase Index:

## Project Overview:
newFastReID is a PyTorch based library for general instance reidentification tasks, based on the original fastreid implementation, tested on Python 3.11 and compatible with Python 3.8+.

## Core Components:

### 1. Configuration System (`fastreid/config/`):
- **config.py**: Configuration management using YACS.
- **defaults.py**: Default configuration values.
- **Base configs**: Located in `configs/` directory.

### 2. Data Handling (`fastreid/data/`):
- **Datasets**: Multiple dataset implementations in `datasets/`.
- Market1501, DukeMTMC, MSMT17, VeRiWild, etc.
- **Samplers**: Batch sampling strategies in `samplers/`.
- Triplet sampling.
- Imbalance sampling.
- Data sampling.
- **Transforms**: Image augmentation in `transforms/`.
- Auto augmentation.
- Standard transformations.
- Custom transforms.

### 3. Training Engine (`fastreid/engine/`):
- **train_loop.py**: Core training logic.
- **defaults.py**: Default trainer implementation.
- **hooks.py**: Training hooks for various functionalities.
- **launch.py**: Training launch utilities.

### 4. Evaluation (`fastreid/evaluation/`):
- **evaluator.py**: Base evaluation framework.
- **reid_evaluation.py**: ReID specific metrics.
- **rerank.py**: ReRanking implementations.
- **roc.py**: ROC curve calculations.
- **query_expansion.py**: Query expansion methods.

### 5. Model Architecture (`fastreid/modeling/`):
- **Backbones**: Network architectures.
- ResNet variants.
- IBN Net.
- OSNet.
- **Heads**: Feature embedding layers.
- **Losses**: Various loss functions.
- Triplet loss.
- Cross entropy.
- Circle loss.
- **Meta Architectures**: High level model definitions.

### 6. Neural Network Layers (`fastreid/layers/`):
- **batch_norm.py**: Batch normalization implementations.
- **non_local.py**: Non local blocks.
- **se_layer.py**: Squeeze and Excitation layers.
- **frn.py**: Filter Response Normalization.
- **gather_layer.py**: Gather operations.
- **context_block.py**: Context modeling blocks.

### 7. Optimization (`fastreid/solver/`)
- **build.py**: Optimizer construction.
- **lr_scheduler.py**: Learning rate scheduling.
- **optim/**: Optimizer implementations.

### 8. Utility Functions (`fastreid/utils/`):
- **checkpoint.py**: Model checkpointing.
- **comm.py**: Distributed training utilities.
- **logger.py**: Logging functionality.
- **file_io.py**: File operations.
- **visualizer.py**: Visualization tools.
- **metrics.py**: Performance metrics.

### 9. Command line Tools (`fastreid/tools/`):
- **train.py**: Training script.
- **test.py**: Evaluation script.
- **demo.py**: Demo applications.

## Project Structure
```
newFastReID/
├── .github/
├── .gitignore
├── CODEBASE_INDEX.md
├── fastreid/
│ ├── config/
│ │ ├── config.py
│ │ ├── defaults.py
│ │ └── __init__.py
│ ├── configs/
│ │ ├── Base-bagtricks.yml
│ │ └── Market1501/
│ ├── data/
│ │ ├── build.py
│ │ ├── common.py
│ │ ├── data_utils.py
│ │ ├── datasets/
│ │ ├── samplers/
│ │ ├── transforms/
│ │ └── __init__.py
│ ├── engine/
│ │ ├── defaults.py
│ │ ├── hooks.py
│ │ ├── launch.py
│ │ ├── train_loop.py
│ │ └── __init__.py
│ ├── evaluation/
│ │ ├── clas_evaluator.py
│ │ ├── evaluator.py
│ │ ├── query_expansion.py
│ │ ├── rank.py
│ │ ├── rank_cylib/
│ │ ├── reid_evaluation.py
│ │ ├── rerank.py
│ │ ├── roc.py
│ │ ├── testing.py
│ │ └── __init__.py
│ ├── layers/
│ │ ├── activation.py
│ │ ├── any_softmax.py
│ │ ├── batch_norm.py
│ │ ├── context_block.py
│ │ ├── drop.py
│ │ ├── frn.py
│ │ ├── gather_layer.py
│ │ ├── helpers.py
│ │ ├── non_local.py
│ │ ├── pooling.py
│ │ ├── se_layer.py
│ │ ├── splat.py
│ │ ├── weight_init.py
│ │ └── __init__.py
│ ├── modeling/
│ │ ├── backbones/
│ │ ├── heads/
│ │ ├── losses/
│ │ ├── meta_arch/
│ │ └── __init__.py
│ ├── solver/
│ │ ├── build.py
│ │ ├── lr_scheduler.py
│ │ ├── optim/
│ │ └── __init__.py
│ ├── tools/
│ ├── utils/
│ │ ├── checkpoint.py
│ │ ├── collect_env.py
│ │ ├── comm.py
│ │ ├── compute_dist.py
│ │ ├── env.py
│ │ ├── events.py
│ │ ├── faiss_utils.py
│ │ ├── file_io.py
│ │ ├── history_buffer.py
│ │ ├── logger.py
│ │ ├── params.py
│ │ ├── precision_bn.py
│ │ ├── registry.py
│ │ ├── summary.py
│ │ ├── timer.py
│ │ ├── visualizer.py
│ │ └── __init__.py
│ └── __init__.py
├── fastreid.egg-info/
├── generate_config.py
├── test_model_compatibility.py
├── LICENSE
├── MANIFEST.in
├── MODEL_ZOO_COMPATIBILITY.md
├── pyproject.toml
├── README.md
├── README_FOR_DEVELOPERS.md
├── tests/
│ ├── dataset_test.py
│ ├── lr_scheduler_test.py
│ ├── model_test.py
│ ├── sampler_test.py
│ ├── test_repvgg.py
│ └── __init__.py
└── tools/
└── generate_model_config.py
```

## Key Features:
1. **Modular Design**: Easy to extend with new datasets, models, and training strategies.
2. **Multi GPU Support**: Distributed training capabilities.
3. **Rich Model Zoo**: Various pretrained models.
4. **Comprehensive Metrics**: Standard ReID evaluation metrics.
5. **Flexible Configuration**: YAML based configuration system.

## Development Guidelines:
1. Use provided registries for new components.
2. Follow the modular architecture.
3. Write tests for new functionality.
4. Document code changes.
5. Maintain backward compatibility.

## Performance Optimizations:
1. Efficient data loading.
2. GPU memory optimization.
3. Distributed training support.
4. Fast evaluation implementations.

## Testing:
- Unit tests in `tests/` directory.
- Model compatibility tests.
- Dataset validation tools.

## Dependencies:
Core dependencies are managed in `pyproject.toml`:
- PyTorch >= 1.9.0
- torchvision >= 0.10.0
- numpy >= 1.19.0
- yacs >= 0.1.8
- opencv-python >= 4.5.0

## License:
Apache License 2.0
80 changes: 80 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# Contributing to FastReID

Thank you for your interest in contributing to FastReID! This guide will help you get started.

## Development Setup

1. **Fork the repository** and clone your fork:
```bash
git clone https://github.com/YOUR_USERNAME/fast-reid.git
cd fast-reid
```

2. **Create a virtual environment**:
```bash
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
```

3. **Install in development mode**:
```bash
pip install -e .[dev]
```

## Making Changes

1. **Create a feature branch**:
```bash
git checkout -b feature/your-feature-name
```

2. **Make your changes** following the code style guidelines

3. **Test your changes**:
```bash
python -m pytest tests/
python test_model_compatibility.py # If applicable
```

4. **Commit your changes**:
```bash
git add .
git commit -m "feat: description of your changes"
```

## Code Style

- Follow PEP 8 guidelines
- Use meaningful variable and function names
- Add docstrings to new functions and classes
- Keep line length under 100 characters

## Testing

- Add tests for new functionality
- Ensure all existing tests pass
- Test with different Python versions (3.8-3.12) if possible

## Submitting Changes

1. **Push to your fork**:
```bash
git push origin feature/your-feature-name
```

2. **Create a Pull Request** with:
- Clear description of changes
- Reference to any related issues
- Screenshots/examples if applicable

## Types of Contributions

- **Bug fixes**: Fix issues in existing code
- **New features**: Add new functionality
- **Documentation**: Improve or add documentation
- **Performance**: Optimize existing code
- **Tests**: Add or improve test coverage

## Questions?

Feel free to open an issue for questions or join our community discussions.
Loading