Skip to content

Commit 6623e24

Browse files
authored
Merge pull request #20 from lombokai/dev
Merge from dev to main branch
2 parents 28c91b8 + b9d347c commit 6623e24

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+503
-183
lines changed

.github/workflows/dev.yaml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: "On Merge dev: Release Dev"
2+
3+
concurrency:
4+
group: dev-build-deploy-${{ github.ref }}
5+
cancel-in-progress: true
6+
7+
on:
8+
workflow_dispatch:
9+
push:
10+
branches:
11+
- dev
12+
13+
permissions: write-all
14+
15+
16+
jobs:
17+
release:
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- uses: actions/checkout@v3
22+
with:
23+
fetch-depth: 0
24+
25+
- name: Get Latest Tag
26+
id: latest-tag
27+
run: echo "tag=$(git tag -l | sort -V | tail -1 | sed 's/-dev$//')" >> "$GITHUB_OUTPUT"
28+
29+
- name: Generate New Bumped Version
30+
uses: actions-ecosystem/action-bump-semver@v1
31+
id: bump-semver
32+
with:
33+
current_version: ${{ steps.latest-tag.outputs.tag }}
34+
level: patch
35+
36+
- name: Create Release Notes
37+
id: create-release
38+
run: |
39+
curl -f -X POST \
40+
-H "Accept: application/vnd.github.v3+json" \
41+
-H "authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
42+
-H "X-GitHub-Api-Version: 2022-11-28" \
43+
https://api.github.com/repos/${{ github.repository }}/releases \
44+
-d '{"tag_name":"${{ steps.bump-semver.outputs.new_version }}", "generate_release_notes":true}'

.github/workflows/main.yaml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: "On Merge main: Release Dev"
2+
3+
concurrency:
4+
group: main-build-deploy-${{ github.ref }}
5+
cancel-in-progress: true
6+
7+
on:
8+
workflow_dispatch:
9+
push:
10+
branches:
11+
- main
12+
13+
permissions: write-all
14+
15+
jobs:
16+
release:
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- uses: actions/checkout@v3
21+
with:
22+
fetch-depth: 0
23+
24+
- name: Get Latest Tag
25+
id: latest-tag
26+
run: echo "tag=$(git tag -l | sort -V | tail -1 | sed 's/-dev$//')" >> "$GITHUB_OUTPUT"
27+
28+
- name: Generate New Bumped Version
29+
uses: actions-ecosystem/action-bump-semver@v1
30+
id: bump-semver
31+
with:
32+
current_version: ${{ steps.latest-tag.outputs.tag }}
33+
level: minor
34+
35+
- name: Create Release Notes
36+
id: create-release
37+
run: |
38+
curl -f -X POST \
39+
-H "Accept: application/vnd.github.v3+json" \
40+
-H "authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
41+
-H "X-GitHub-Api-Version: 2022-11-28" \
42+
https://api.github.com/repos/${{ github.repository }}/releases \
43+
-d '{"tag_name":"${{ steps.bump-semver.outputs.new_version }}", "generate_release_notes":true}'

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,4 +166,4 @@ cython_debug/
166166
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
167167
#.idea/
168168

169-
# data/
169+
# data/

.pre-commit-config.yaml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.4.0
4+
hooks:
5+
- id: fix-byte-order-marker
6+
- id: check-yaml
7+
- id: end-of-file-fixer
8+
- id: requirements-txt-fixer
9+
- id: trailing-whitespace
10+
args: [--markdown-linebreak-ext=md]
11+
12+
- repo: https://github.com/myint/autoflake
13+
rev: v2.3.1
14+
hooks:
15+
- id: autoflake
16+
args:
17+
- --in-place
18+
- --remove-all-unused-imports
19+
- --remove-unused-variables
20+
- --ignore-init-module-imports
21+
22+
- repo: https://github.com/pycqa/flake8
23+
rev: 3.9.2 # Use the latest commit SHA or tag
24+
hooks:
25+
- id: flake8
26+
27+
- repo: https://github.com/psf/black
28+
rev: 24.4.2
29+
hooks:
30+
- id: black
31+
32+
- repo: https://github.com/pycqa/isort
33+
rev: 5.13.2
34+
hooks:
35+
- id: isort
36+
name: isort (python)
37+
38+
# - repo: https://github.com/PyCQA/bandit
39+
# rev: 1.7.5 # Update me!
40+
# hooks:
41+
# - id: bandit
42+
# args: ["--ini", "iquote/.bandit"]
43+
# # additional_dependencies: ["bandit[toml]"]
44+
45+
# - repo: https://github.com/Lucas-C/pre-commit-hooks-safety
46+
# rev: v1.3.1
47+
# hooks:
48+
# - id: python-safety-dependencies-check
49+
# # args: ["--disable-telemetry"]

Makefile

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,18 @@
1+
.PHONY: .venv
2+
13
run-test:
2-
PYTHONPATH=src python -m pytest -v
4+
ifdef dst
5+
PYTHONPATH=.:src python -m pytest $(dst) -v
6+
else
7+
PYTHONPATH=.:src python -m pytest -v
8+
endif
9+
10+
clear-cache:
11+
find . -type d -name '__pycache__' -exec rm -r {} + \
12+
&& find . -type f -name '*.pyc' -delete
13+
14+
run-test-cov:
15+
@PYTHONPATH=.:app:$PYTHONPATH pytest --cov=app --cov-report=xml
16+
17+
precommit:
18+
pre-commit run --all-files

README.md

Lines changed: 83 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,83 @@
1-
# onepiece-classifier
2-
An image recognition of one piece anime character
1+
# Machine Learning Project Documentation
2+
3+
## Project Overview
4+
This repository contains programs for classifying images. The images used for this project are images of Onepiece anime characters. There are 18 predicted anime characters. This project is packaged in the form of a python package so that it can be used by the public.
5+
6+
## Installation Guide
7+
### Requirements
8+
It is recommended to run this application within a virtual environment. First thing first is clone the repository
9+
10+
```sh
11+
git clone https://github.com/lombokai/onepiece-classifier.git
12+
```
13+
### Virtual Environment Setup
14+
create a virtual environment
15+
16+
```sh
17+
python3 -m venv <virtual environment name>
18+
```
19+
20+
command line to activate your virtual environment in linux
21+
```sh
22+
source <virtual environment name>/bin/activate
23+
```
24+
25+
command line to activate your virtual environment in windows
26+
```sh
27+
<virtual environment name>\Scripts\activate
28+
```
29+
30+
install package requirements
31+
```sh
32+
pip install -r requirements/main.txt
33+
```
34+
35+
## Usage
36+
### Example Usage
37+
This package provide image to predict in `assets` directory. If you want to try predict an image, run predict.py script with command bellow
38+
```
39+
python3 predict.py <image path>
40+
```
41+
42+
command example if you are working in parent directory of this repo
43+
44+
```sh
45+
python3 predict.py assets/luffy.png
46+
```
47+
48+
try to predict different image with command above
49+
50+
### Run the Application
51+
install onepiece-classify package
52+
```sh
53+
pip install onepiece-classify
54+
```
55+
56+
acces predict method from onepiece-classify pakcage
57+
58+
```python
59+
from onepiece_classify.infer import ImageRecognition
60+
```
61+
62+
instantiate the class with your model path. Download trained model [here](https://drive.google.com/file/d/1M1-1Hs198XDD6Xx-kSWLThv1elZBzJ0j/view?usp=sharing) and make sure you specify model path parameter in the location of downloaded model
63+
64+
```python
65+
predictor = ImageRecognition(<model path>)
66+
```
67+
68+
then you just predict your image with `predict` method
69+
```python
70+
predictor.predict(<your image path>)
71+
```
72+
73+
74+
## Data Description
75+
### Data Sources
76+
Data obtained from Kaggle [here](https://www.kaggle.com/datasets/ibrahimserouis99/one-piece-image-classifie). The data contains a collection of 18 onepiece character images, and is saved in jpg, jpeg and png formats.
77+
78+
## Contributing
79+
When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.
80+
81+
## License
82+
83+
[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)

assets/ace.png

145 KB
Loading

assets/akainu.png

70.4 KB
Loading

assets/brook.png

33.3 KB
Loading

assets/chopper.png

75.2 KB
Loading

0 commit comments

Comments
 (0)