Skip to content

Commit e00a760

Browse files
committed
new repo
0 parents  commit e00a760

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

+2927
-0
lines changed

.dvc/.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/config.local
2+
/tmp
3+
/cache

.dvc/config

Whitespace-only changes.

.dvcignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Add patterns of files dvc should ignore, which could improve
2+
# the performance. Learn more at
3+
# https://dvc.org/doc/user-guide/dvcignore

.github/workflows/.gitkeep

Whitespace-only changes.

.github/workflows/main.yml

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: CML
2+
on: [push]
3+
jobs:
4+
train-and-report:
5+
runs-on: ubuntu-latest
6+
container: docker://ghcr.io/iterative/cml:0-dvc2-base1
7+
steps:
8+
- uses: actions/checkout@v3
9+
- run: |
10+
pip install -r requirements.txt
11+
python main.py # create score.json
12+
13+
# Create CML report
14+
cat score.json >> report.md
15+
# echo '![](./plot.png "Confusion Matrix")' >> report.md
16+
17+
env:
18+
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

+166
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
ml-environment/
7+
artifacts/
8+
data/
9+
LOGS/
10+
# C extensions
11+
*.so
12+
13+
# Distribution / packaging
14+
.Python
15+
build/
16+
develop-eggs/
17+
dist/
18+
downloads/
19+
eggs/
20+
.eggs/
21+
lib/
22+
lib64/
23+
parts/
24+
sdist/
25+
var/
26+
wheels/
27+
share/python-wheels/
28+
*.egg-info/
29+
.installed.cfg
30+
*.egg
31+
MANIFEST
32+
33+
# PyInstaller
34+
# Usually these files are written by a python script from a template
35+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
36+
*.manifest
37+
*.spec
38+
39+
# Installer logs
40+
pip-log.txt
41+
pip-delete-this-directory.txt
42+
43+
# Unit test / coverage reports
44+
htmlcov/
45+
.tox/
46+
.nox/
47+
.coverage
48+
.coverage.*
49+
.cache
50+
nosetests.xml
51+
coverage.xml
52+
*.cover
53+
*.py,cover
54+
.hypothesis/
55+
.pytest_cache/
56+
cover/
57+
58+
# Translations
59+
*.mo
60+
*.pot
61+
62+
# Django stuff:
63+
*.log
64+
local_settings.py
65+
db.sqlite3
66+
db.sqlite3-journal
67+
68+
# Flask stuff:
69+
instance/
70+
.webassets-cache
71+
72+
# Scrapy stuff:
73+
.scrapy
74+
75+
# Sphinx documentation
76+
docs/_build/
77+
78+
# PyBuilder
79+
.pybuilder/
80+
target/
81+
82+
# Jupyter Notebook
83+
.ipynb_checkpoints
84+
85+
# IPython
86+
profile_default/
87+
ipython_config.py
88+
89+
# pyenv
90+
# For a library or package, you might want to ignore these files since the code is
91+
# intended to run in multiple environments; otherwise, check them in:
92+
# .python-version
93+
94+
# pipenv
95+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
96+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
97+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
98+
# install all needed dependencies.
99+
#Pipfile.lock
100+
101+
# poetry
102+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
103+
# This is especially recommended for binary packages to ensure reproducibility, and is more
104+
# commonly ignored for libraries.
105+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
106+
#poetry.lock
107+
108+
# pdm
109+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
110+
#pdm.lock
111+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
112+
# in version control.
113+
# https://pdm.fming.dev/#use-with-ide
114+
.pdm.toml
115+
116+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
117+
__pypackages__/
118+
119+
# Celery stuff
120+
celerybeat-schedule
121+
celerybeat.pid
122+
123+
# SageMath parsed files
124+
*.sage.py
125+
126+
# Environments
127+
.env
128+
.venv
129+
env/
130+
venv/
131+
ENV/
132+
env.bak/
133+
venv.bak/
134+
# ml-environment
135+
136+
# Spyder project settings
137+
.spyderproject
138+
.spyproject
139+
artifacts
140+
141+
# Rope project settings
142+
.ropeproject
143+
144+
# mkdocs documentation
145+
/site
146+
147+
# mypy
148+
.mypy_cache/
149+
.dmypy.json
150+
dmypy.json
151+
152+
# Pyre type checker
153+
.pyre/
154+
155+
# pytype static type analyzer
156+
.pytype/
157+
158+
# Cython debug symbols
159+
cython_debug/
160+
161+
# PyCharm
162+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
163+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
164+
# and can be added to the global gitignore or merged into this file. For a more nuclear
165+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
166+
#.idea/

LICENSE

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023 Aman Kumar
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# End-to-End-Image-Classification-MLOPS-implementation
2+
3+
<img src="project-image.png">
4+
5+
6+

config/config.yaml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
artifacts_root: artifacts
2+
3+
data_ingestion:
4+
root_dir: data
5+
source_URL: https://github.com/Aman123lug/Data-storage-for-all-projects/raw/main/Chicken-fecal-images.zip
6+
local_data_file: artifacts/data_ingestion/data.zip
7+
unzip_dir: artifacts/data_ingestion
8+
9+
prepare_base_model:
10+
root_dir: artifacts/prepare_base_model
11+
base_model_config: artifacts/prepare_base_model/base_model.h5
12+
updated_base_model_config: artifacts/prepare_base_model/base_model_updated.h5
13+
14+
15+
prepare_callbacks:
16+
root_dir: artifacts/prepare_callbacks
17+
tensorboard_root_log_dir: artifacts/prepare_callbacks/tensorboard_root_log_dir
18+
checkpoint_model_filepath: artifacts/prepare_callbacks/checkpoint_root_log_dir/model.h5
19+
20+
21+
training:
22+
root_dir: artifacts/training
23+
train_model_path: artifacts/training/model.h5

dvc.yaml

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
stages:
2+
data_ingestion:
3+
cmd: python src/cnnClassifier/pipline/stage_01_data_ingestion.py
4+
deps:
5+
- src/cnnClassifier/pipline/stage_01_data_ingestion.py
6+
- config/config.yaml
7+
outs:
8+
- data/Chicken-fecal-images
9+
10+
prepare_base_model:
11+
cmd: python src/cnnClassifier/pipline/stage_02_prepare_base_model.py
12+
deps:
13+
- src/cnnClassifier/pipline/stage_02_prepare_base_model.py
14+
- config/config.yaml
15+
16+
params:
17+
- IMAGE_SIZE
18+
- INCLUDE_TOP
19+
- CLASSES
20+
- WEIGHTS
21+
- LEARNING_RATE
22+
23+
outs:
24+
- artifacts/prepare_base_model
25+
26+
27+
training:
28+
cmd: python src/cnnClassifier/pipline/stage_03_training.py
29+
deps:
30+
31+
- src/cnnClassifier/pipline/stage_03_training.py
32+
- src/cnnClassifier/components/prepare_callbacks.py
33+
- config/config.yaml
34+
- data/Chicken-fecal-images
35+
- artifacts/prepare_base_model
36+
37+
params:
38+
- EPOCH
39+
- BATCH_SIZE
40+
- IMAGE_SIZE
41+
- AUGMENTATION
42+
43+
outs:
44+
- artifacts/training/model.h5
45+
46+
model_evaluation:
47+
cmd: python src/cnnClassifier/pipline/stage_04_evaluation.py
48+
deps:
49+
- src/cnnClassifier/pipline/stage_04_evaluation.py
50+
- config/config.yaml
51+
- data/Chicken-fecal-images
52+
- artifacts/training/model.h5
53+
params:
54+
- IMAGE_SIZE
55+
- BATCH_SIZE
56+
metrics:
57+
- score.josn:
58+
cache: false

main.py

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
from src.cnnClassifier.loggerr import logger
2+
from src.cnnClassifier.pipline.stage_01_data_ingestion import DataIngestionTrainingPipeline
3+
from src.cnnClassifier.pipline.stage_02_prepare_base_model import PrepareBaseModelTrainingPipeline
4+
from src.cnnClassifier.pipline.stage_03_training import ModelTrainingPipeline
5+
from src.cnnClassifier.pipline.stage_04_evaluation import ModelEvaluation
6+
7+
STAGE_NAME = "Data Ingestion"
8+
try:
9+
logger.info(f" <<<< stage {STAGE_NAME} <<<< started")
10+
data_ingestion = DataIngestionTrainingPipeline()
11+
data_ingestion.main()
12+
logger.info(f" <<<< stage {STAGE_NAME} >>>> completed !")
13+
14+
except Exception as e:
15+
# logger.exception(e)
16+
raise e
17+
18+
STAGE_NAME = "Prepare Base Model"
19+
try:
20+
logger.info(f" <<<< stage {STAGE_NAME} <<<< started")
21+
base_model = PrepareBaseModelTrainingPipeline()
22+
base_model.main()
23+
logger.info(f" <<<< stage {STAGE_NAME} >>>> completed !")
24+
25+
except Exception as e:
26+
logger.exception(e)
27+
raise e
28+
29+
30+
STAGE_NAME = "Training"
31+
try:
32+
logger.info(f"<<<< stage {STAGE_NAME} started >>>>")
33+
train = ModelTrainingPipeline()
34+
train.main()
35+
logger.info(f"<<<< stage {STAGE_NAME} completed >>>>")
36+
37+
except Exception as e:
38+
logger.exception(e)
39+
raise e
40+
41+
42+
STAGE_NAME = "Model Evaluation"
43+
try:
44+
logger.info(f"<<<< Stage {STAGE_NAME} started")
45+
evaluate = ModelEvaluation()
46+
evaluate.main()
47+
logger.info(f"<<<< stage {STAGE_NAME} completed >>>>")
48+
49+
except Exception as e:
50+
logger.exception(e)
51+
raise e

params.yaml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
AUGMENTATION: True
2+
IMAGE_SIZE: [224, 224, 3]
3+
BATCH_SIZE: 16
4+
INCLUDE_TOP: False
5+
EPOCH: 1
6+
LEARNING_RATE: 0.01
7+
CLASSES: 2
8+
WEIGHTS: imagenet
9+
10+
11+

project-image.png

4.62 MB
Loading

requirements.txt

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
scikit-learn
2+
tensorflow
3+
dvc
4+
pandas
5+
numpy
6+
notebook
7+
matplotlib
8+
seaborn
9+
python-box==6.0.2
10+
pyYAML
11+
tqdm
12+
ensure==1.0.2
13+
joblib
14+
spacy
15+
Flask
16+
Flask-Cors
17+
18+
-e .

0 commit comments

Comments
 (0)