-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Release v2.3.0, add GitHub Actions and SonarCloud
* add normalize_images method as an abstract method in image_processors.py * fix: change OpenCVVideo method name get_next_video_frames -> get_next_frames * move out normalizing images from evalutor to extractors * rename get_extractor() -> create_extractor() in ExtractorFactory * add license to docstrings * move ServiceShutdownSignal inside DockerManager * make ServiceInitializer attributes protected * add architecture section to README * add created status to manager and tests * add cpu-only flag * add new quick_demo.bat files * add new flag to readme * change requirements in readme * fix paths in docker-compose.yaml and change method 2 in readme * add 'created at' badge * change _get_image_evaluator() to returns ImageEvaluator insted of specific evaluator * fix DIP in extractors * add pylint to dependendcies * move extractor service tests to root dir and fix imports * move service_manager tests to root folder tests and fix paths * fix extractors unit tests after fixing DIP in extractors * move dependency injection to extractors manager * add dependencies module * change README files tests sections after moving tests to root folder * use Depends() from FastAPI for better dependencies handling and refactor code and tests * add tests for dependencies.py * small changes in docstings, small refactor code changes * change logging level to INFO * change cpu_only to True in integration tests in service_manager * add --cpu flag to service_manager e2e tests * add .gitkeep to test_files * fix test_video * fix paths in test_add_prefix * Add local server to run_tests.yml * add skipif in service_manager e2e tests * remove additional server in github actions * change http to https * add assert before isinstance() * change 'is not None' to just 'assert extractor' * fix logging check in test_list_input_directory_files * Fix assertion for _dropout_rate to float with tolerance * Add comment before pass in test_get_video_capture_failure for clarity * remove magic values in test_get_next_video_frames * remove overwriting client variable in image fixture * fix removing test folders after tests * add sleep 300 command as a constant for handling DRY * fix test_container_status * save log_lines as constants for handling DRY * remove unused variable pop * Remove the unused local variable 'container' * add test video
- Loading branch information
Showing
70 changed files
with
712 additions
and
304 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
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
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
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
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
File renamed without 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,95 @@ | ||
""" | ||
This module provides dependency management for extractors using FastAPI's dependency injection. | ||
LICENSE | ||
======= | ||
Copyright (C) 2024 Bartłomiej Flis | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
""" | ||
from dataclasses import dataclass | ||
from typing import Type | ||
|
||
from fastapi import Depends | ||
|
||
from .image_evaluators import InceptionResNetNIMA | ||
from .image_processors import OpenCVImage | ||
from .video_processors import OpenCVVideo | ||
|
||
|
||
@dataclass | ||
class ExtractorDependencies: | ||
""" | ||
Data class to hold dependencies for the extractor. | ||
Attributes: | ||
image_processor (Type[OpenCVImage]): Processor for image processing. | ||
video_processor (Type[OpenCVVideo]): Processor for video processing. | ||
evaluator (Type[InceptionResNetNIMA]): Evaluator for image quality. | ||
""" | ||
image_processor: Type[OpenCVImage] | ||
video_processor: Type[OpenCVVideo] | ||
evaluator: Type[InceptionResNetNIMA] | ||
|
||
|
||
def get_image_processor() -> Type[OpenCVImage]: | ||
""" | ||
Provides the image processor dependency. | ||
Returns: | ||
Type[OpenCVImage]: The image processor class. | ||
""" | ||
return OpenCVImage | ||
|
||
|
||
def get_video_processor() -> Type[OpenCVVideo]: | ||
""" | ||
Provides the video processor dependency. | ||
Returns: | ||
Type[OpenCVVideo]: The video processor class. | ||
""" | ||
return OpenCVVideo | ||
|
||
|
||
def get_evaluator() -> Type[InceptionResNetNIMA]: | ||
""" | ||
Provides the image evaluator dependency. | ||
Returns: | ||
Type[InceptionResNetNIMA]: The image evaluator class. | ||
""" | ||
return InceptionResNetNIMA | ||
|
||
|
||
def get_extractor_dependencies( | ||
image_processor=Depends(get_image_processor), | ||
video_processor=Depends(get_video_processor), | ||
evaluator=Depends(get_evaluator) | ||
) -> ExtractorDependencies: | ||
""" | ||
Provides the dependencies required for the extractor. | ||
Args: | ||
image_processor (Type[OpenCVImage], optional): Dependency injection for image processor. | ||
video_processor (Type[OpenCVVideo], optional): Dependency injection for video processor. | ||
evaluator (Type[InceptionResNetNIMA], optional): Dependency injection for image evaluator. | ||
Returns: | ||
ExtractorDependencies: All necessary dependencies for the extractor. | ||
""" | ||
return ExtractorDependencies( | ||
image_processor=image_processor, | ||
video_processor=video_processor, | ||
evaluator=evaluator | ||
) |
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
Oops, something went wrong.