-
-
Notifications
You must be signed in to change notification settings - Fork 527
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactored MTCNN codebase with significant optimizations and added ba…
…tch processing support - Completely refactored the MTCNN implementation following best coding practices. - Optimized code by removing unnecessary transpositions, resulting in faster computation. Fixes #22. - Transposed convolutional layer weights to eliminate the need for additional transpositions during preprocessing and postprocessing, improving overall efficiency. - Converted preprocessing and postprocessing functions into matrix operations to accelerate computation. Fixes #14, #110. - Added batch processing support to enhance performance for multiple input images. Fixes #9, #71. - Migrated network architecture to TensorFlow >= 2.12 for improved compatibility and performance. Fixes #80, #82, #90, #91, #93, #98, #104, #112, #114, #115, #116. - Extensively documented the project with detailed explanations of thresholds and parameters. Fixes #12, #41, #52, #57, #99, #122, #117. - Added support for selecting computation backends (CPU, GPU, etc.) with the `device` parameter. Fixes #23. - Added new parameters to control the result format (support for x1, y1, x2, y2 instead of x1, y1, width, height) and the ability to return tensors instead of dictionaries. Fixes #72. - Configured PyLint support to ensure code quality and style adherence. - Organized functions into specific modules (`mtcnn.utils.*` and `mtcnn.stages.*`) for better modularity. - Created Jupyter notebooks for visualization and ablation studies of each stage, allowing detailed exploration of layers, weights, and intermediate results. Fixes #88, #102. - Added a comprehensive training guide for the model. Fixes #35, #39. - Updated README with information on the new version, including the complete Read the Docs documentation that describes the process, theoretical background, and usage examples. Fixes #53, #73. - Configured GitHub Actions for continuous integration and delivery (CI/CD). - Fixed memory leak by switching to a more efficient TensorFlow method (`model(tensor)` instead of `model.predict(tensor)`). Fixes #87, #109, #121, #125, #128. - Made TensorFlow an optional dependency to prevent conflicts with user-installed versions. Fixes #95. - Added comprehensive unit tests for increased reliability and coverage.
- Loading branch information
Iván de Paz
committed
Oct 7, 2024
1 parent
c2f0d00
commit 1ff7228
Showing
74 changed files
with
7,339 additions
and
1,360 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# Contributing Guidelines | ||
|
||
Thank you for considering contributing to this project! Please follow these guidelines to ensure smooth collaboration. | ||
|
||
## How to Report a Bug | ||
1. Search for similar issues in the existing issues list. | ||
2. If the issue is new, open a bug report using the provided template. | ||
3. Provide as much detail as possible, including steps to reproduce the issue. | ||
|
||
## How to Submit a Pull Request | ||
1. Fork the repository and create a new branch. | ||
2. Make your changes following the code style guidelines. | ||
3. Run tests to ensure everything is working. | ||
4. Open a pull request with a detailed description of your changes. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
github: ipazc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
--- | ||
name: Bug Report | ||
about: Report a bug to help the project improve | ||
title: "[Bug] Your bug title" | ||
labels: bug | ||
assignees: '' | ||
|
||
--- | ||
|
||
**Describe the bug** | ||
A clear and concise description of what the bug is. | ||
|
||
**To Reproduce** | ||
Steps to reproduce the behavior, numbered if possible. | ||
|
||
**Expected behavior** | ||
A clear and concise description of what you expected to happen. | ||
|
||
**Screenshots** | ||
If applicable, add screenshots to help explain your problem. | ||
|
||
**Environment (please complete the following information):** | ||
- OS: [e.g., Windows, macOS, Linux] | ||
- Python version: [e.g., 3.9] | ||
- Version of the project: [e.g., 1.0.0] | ||
|
||
**Additional context** | ||
Add any other context about the problem here. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--- | ||
name: Feature Request | ||
about: Suggest a new feature or enhancement | ||
title: "[Feature] Your feature title" | ||
labels: enhancement | ||
assignees: '' | ||
|
||
--- | ||
|
||
**Is your feature request related to a problem? Please describe.** | ||
A clear and concise description of what the problem is. Ex: I'm always frustrated when [...] | ||
|
||
**Describe the solution you'd like** | ||
A clear and concise description of what you want to happen. | ||
|
||
**Describe alternatives you've considered** | ||
A clear and concise description of any alternative solutions or features you've considered. | ||
|
||
**Additional context** | ||
Add any other context or screenshots about the feature request here. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# Pull Request Title | ||
|
||
## Description | ||
Please include a summary of the changes and the related issue. Please also include relevant motivation and context. | ||
|
||
Fixes # (issue) | ||
|
||
## Type of change | ||
Please delete options that are not relevant. | ||
- [ ] Bug fix (non-breaking change which fixes an issue) | ||
- [ ] New feature (non-breaking change which adds functionality) | ||
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) | ||
- [ ] Documentation update | ||
|
||
## Checklist | ||
- [ ] My code follows the style guidelines of this project | ||
- [ ] I have performed a self-review of my code | ||
- [ ] I have commented my code, particularly in hard-to-understand areas | ||
- [ ] I have made corresponding changes to the documentation | ||
- [ ] My changes generate no new warnings | ||
- [ ] I have added tests that prove my fix is effective or that my feature works | ||
- [ ] New and existing unit tests pass locally with my changes | ||
|
||
## Additional Information | ||
Add any other relevant information, screenshots, or details about the pull request. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Security Policy | ||
|
||
## Reporting a Vulnerability | ||
If you discover a security vulnerability, please do not create a public issue. Instead, report it via email to [ipazc@unileon.es]. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: Pylint | ||
|
||
on: [push] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ["3.10", "3.11", "3.12"] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install pylint | ||
- name: Analysing the code with pylint | ||
run: | | ||
pylint $(git ls-files '*.py') | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
name: Build and Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*.*.*' | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check out the code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
|
||
- name: Build the Python package | ||
run: | | ||
python setup.py sdist bdist_wheel | ||
- name: Upload artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: python-package-artifacts | ||
path: dist/* | ||
|
||
|
||
release: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Download artifact | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: python-package-artifacts | ||
|
||
- name: Create GitHub Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: Release ${{ github.ref }} | ||
draft: false | ||
prerelease: false | ||
|
||
- name: Upload artifacts to release | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: dist/* | ||
asset_name: $(basename ${{ asset_path }}) | ||
asset_content_type: application/octet-stream | ||
|
||
|
||
publish-to-pypi: | ||
needs: release # This ensures that this job runs after the release job completes | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check out the code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
|
||
- name: Install dependencies | ||
run: pip install build twine | ||
|
||
- name: Download artifact | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: python-package-artifacts | ||
|
||
- name: Publish to PyPI | ||
env: | ||
TWINE_USERNAME: __token__ | ||
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | ||
run: twine upload dist/* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Run Tests | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check out the repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.10' | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements-dev.txt -r requirements.txt -r requirements-tf.txt | ||
- name: Run tests with coverage | ||
run: | | ||
pytest --cov=mtcnn --cov-report=xml --cov-report=term | ||
Oops, something went wrong.