Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2.3.1 #33

Merged
merged 8 commits into from
Jun 9, 2024
Merged
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
16 changes: 9 additions & 7 deletions .github/README.pl.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@
<div id="badges">
<p align="center">
<img alt="Github Created At" src="https://img.shields.io/github/created-at/BKDDFS/PerfectFrameAI">
<img alt="GitHub Downloads (all assets, all releases)" src="https://img.shields.io/github/downloads/BKDDFS/PerfectFrameAI/total?style=flat&color=blue">
<img alt="GitHub last commit" src="https://img.shields.io/github/last-commit/BKDDFS/PerfectFrameAI">
<a href="https://codecov.io/github/BKDDFS/PerfectFrameAI" >
<img src="https://codecov.io/github/BKDDFS/PerfectFrameAI/graph/badge.svg?token=GT9TGKBGYI"/>
</a>
<img alt="GitHub License" src="https://img.shields.io/github/license/BKDDFS/PerfectFrameAI">
<img alt="GitHub Release" src="https://img.shields.io/github/v/release/BKDDFS/PerfectFrameAI">
<img alt="GitHub Tag" src="https://img.shields.io/github/v/tag/BKDDFS/PerfectFrameAI">
<img alt="GitHub Repo stars" src="https://img.shields.io/github/stars/BKDDFS/PerfectFrameAI">
</p>
</div>
Expand Down Expand Up @@ -47,7 +50,7 @@
</summary>
<img src="../static/start_frames.png" width="350">
<ol>
<p>Input: Folder z plikami video <code>.mp4</code>.</p>
<p>Input: Folder z plikami video.</p>
<li>Bierze pierwsze video ze wskazanej lokalizacji.</li>
<li>
Dzieli wideo na klatki.
Expand All @@ -69,7 +72,7 @@
</summary>
<img src="../static/start_images.png" width="350">
<ol>
<p>Input: Folder z obrazami <code>.jpg</code>.</p>
<p>Input: Folder z obrazami.</p>
<li>Wczytuje obrazy. Obrazy są przetwarzane batchach(seriach).</li>
<li>Ocenia wszystkie obrazy w batchu za pomocą modelu AI i nadaje im ocenę liczbową.</li>
<li>
Expand All @@ -89,7 +92,7 @@
<p>Modyfikuje <code>best_frames_extractor</code> poprzez pominięcie części z AI/ocenianiem klatek.</p>
<code>python start.py best_frames_extractor --all_frames</code>
<ol>
<p>Input: Folder z plikami video <code>.mp4</code>.</p>
<p>Input: Folder z plikami video.</p>
<li>Bierze pierwsze video ze wskazanej lokalizacji.</li>
<li>
Dzieli wideo na klatki. Klatki są brane co 1 sekundę wideo.
Expand Down Expand Up @@ -448,7 +451,7 @@
</div>
<div id="tests">
<h2>🧪 Testy</h2>
<img src="../static/tests_passed.png">
<img src="../static/tests.png">
<p>
Testy możesz uruchomić instalując zależności z <code>pyproject.toml</code>
i wpisując w terminal w lokalizacj projektu - <code>pytest</code>.
Expand Down Expand Up @@ -498,7 +501,6 @@
Podsumowując, dodanie DALI powinno być kolejnym poważnym krokiem naprzód,
jeśli chodzi o poprawę wydajności.
</li>
<li>Przetestowanie działania na starszych wersjach Pythona.</li>
<li>
Naprawienie spillingu danych podczas oceniania klatek.
Obecnie ocenianie ma delikatne spowolnienie w postaci problemu ze spillingiem.
Expand Down
14 changes: 9 additions & 5 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# This workflow will install Poetry, install Python dependencies, run tests a single version of Python

name: CI

on:
Expand All @@ -11,7 +9,6 @@ on:
permissions:
contents: read


jobs:
build:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -46,8 +43,15 @@ jobs:
run: |
poetry install

- name: Run tests
- name: Run tests with coverage
env:
DOCKER_HOST: tcp://localhost:2375
run: |
poetry run pytest
poetry run pytest --cov --cov-report=xml

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3.1.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
fail_ci_if_error: true
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
<p align="center">
<img alt="Github Created At" src="https://img.shields.io/github/created-at/BKDDFS/PerfectFrameAI">
<img alt="GitHub last commit" src="https://img.shields.io/github/last-commit/BKDDFS/PerfectFrameAI">
<a href="https://codecov.io/github/BKDDFS/PerfectFrameAI" >
<img src="https://codecov.io/github/BKDDFS/PerfectFrameAI/graph/badge.svg?token=GT9TGKBGYI"/>
</a>
<img alt="GitHub License" src="https://img.shields.io/github/license/BKDDFS/PerfectFrameAI">
<img alt="GitHub Tag" src="https://img.shields.io/github/v/tag/BKDDFS/PerfectFrameAI">
<img alt="GitHub Repo stars" src="https://img.shields.io/github/stars/BKDDFS/PerfectFrameAI">
Expand Down Expand Up @@ -47,7 +50,7 @@
</summary>
<img src="static/start_frames.png" width="350">
<ol>
<p>Input: Folder with <code>.mp4</code> video files.</p>
<p>Input: Folder with video files.</p>
<li>Takes the first video from the specified location.</li>
<li>
Splits the video into frames.
Expand All @@ -69,7 +72,7 @@
</summary>
<img src="static/start_images.png" width="350">
<ol>
<p>Input: Folder with <code>.jpg</code> images.</p>
<p>Input: Folder with images.</p>
<li>Loads the images. Images are processed in batches.</li>
<li>Evaluates all images in the batch using an AI model and assigns them a numerical score.</li>
<li>
Expand All @@ -89,7 +92,7 @@
<p>Modifying <code>best_frames_extractor</code> by skipping AI evaluation part.</p>
<code>python start.py best_frames_extractor --all_frames</code>
<ol>
<p>Input: Folder with <code>.mp4</code> video files.</p>
<p>Input: Folder with video files.</p>
<li>Takes the first video from the specified location.</li>
<li>
Splits the video into frames.
Expand Down Expand Up @@ -440,7 +443,7 @@
</div>
<div id="tests">
<h2>🧪 Tests</h2>
<img src="static/tests_passed.png" width="1000" style="border-radius: 10px;">
<img src="static/tests.png" width="1000" style="border-radius: 10px;">
<p>
You can run the tests by installing the dependencies from <code>pyproject.toml</code>
and typing in the terminal in the project location - <code>pytest</code>.
Expand Down Expand Up @@ -490,7 +493,6 @@
In summary, adding DALI should be another significant step forward
in terms of performance improvement.
</li>
<li>Testing on older versions of Python.</li>
<li>
Fixing data spilling during frame evaluation.
Currently, evaluation has a slight slowdown in the form of a spilling issue.
Expand Down
4 changes: 2 additions & 2 deletions extractor_service/app/schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ class ExtractorConfig(BaseModel):
"""
input_directory: DirectoryPath = Path("/app/input_directory")
output_directory: DirectoryPath = Path("/app/output_directory")
video_extensions: tuple[str] = (".mp4",)
images_extensions: tuple[str] = (".jpg",)
video_extensions: tuple[str] = (".mp4", ".mov", ".webm", ".mkv", ".avi") # add more containers here
images_extensions: tuple[str] = (".jpg", ".jpeg", ".png", ".webp") # add more containers here
processed_video_prefix: str = "frames_extracted_"
batch_size: int = 100
compering_group_size: int = 5
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "PerfectFrameAI"
version = "2.3.0"
version = "2.3.1"
description = "AI tool for finding the most aesthetic frames in a video. 🎞️➜🖼️"
authors = ["Bartłomiej Flis <Bartekdawidflis@gmail.com>"]
license = "GPL-3.0 license"
Expand Down
Binary file added static/tests.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed static/tests_passed.png
Binary file not shown.
4 changes: 2 additions & 2 deletions tests/extractor_service/unit/schemas_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ def test_config_default():
config = ExtractorConfig()
assert config.input_directory == Path("/app/input_directory")
assert config.output_directory == Path("/app/output_directory")
assert config.video_extensions == (".mp4",)
assert config.images_extensions == (".jpg",)
assert config.video_extensions == (".mp4", ".mov", ".webm", ".mkv", ".avi")
assert config.images_extensions == (".jpg", ".jpeg", ".png", ".webp")
assert config.processed_video_prefix == "frames_extracted_"
assert isinstance(config.compering_group_size, int)
assert isinstance(config.batch_size, int)
Expand Down
Loading