Skip to content

Commit

Permalink
new repo
Browse files Browse the repository at this point in the history
  • Loading branch information
Aman123lug committed Aug 11, 2023
0 parents commit e00a760
Show file tree
Hide file tree
Showing 46 changed files with 2,927 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .dvc/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/config.local
/tmp
/cache
Empty file added .dvc/config
Empty file.
3 changes: 3 additions & 0 deletions .dvcignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Add patterns of files dvc should ignore, which could improve
# the performance. Learn more at
# https://dvc.org/doc/user-guide/dvcignore
Empty file added .github/workflows/.gitkeep
Empty file.
18 changes: 18 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: CML
on: [push]
jobs:
train-and-report:
runs-on: ubuntu-latest
container: docker://ghcr.io/iterative/cml:0-dvc2-base1
steps:
- uses: actions/checkout@v3
- run: |
pip install -r requirements.txt
python main.py # create score.json
# Create CML report
cat score.json >> report.md
# echo '![](./plot.png "Confusion Matrix")' >> report.md

env:
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
166 changes: 166 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

ml-environment/
artifacts/
data/
LOGS/
# C extensions
*.so

# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib/
lib64/
parts/
sdist/
var/
wheels/
share/python-wheels/
*.egg-info/
.installed.cfg
*.egg
MANIFEST

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.nox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
*.py,cover
.hypothesis/
.pytest_cache/
cover/

# Translations
*.mo
*.pot

# Django stuff:
*.log
local_settings.py
db.sqlite3
db.sqlite3-journal

# Flask stuff:
instance/
.webassets-cache

# Scrapy stuff:
.scrapy

# Sphinx documentation
docs/_build/

# PyBuilder
.pybuilder/
target/

# Jupyter Notebook
.ipynb_checkpoints

# IPython
profile_default/
ipython_config.py

# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
# However, in case of collaboration, if having platform-specific dependencies or dependencies
# having no cross-platform support, pipenv may install dependencies that don't work, or not
# install all needed dependencies.
#Pipfile.lock

# poetry
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
# This is especially recommended for binary packages to ensure reproducibility, and is more
# commonly ignored for libraries.
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
#poetry.lock

# pdm
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
.pdm.toml

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/

# Celery stuff
celerybeat-schedule
celerybeat.pid

# SageMath parsed files
*.sage.py

# Environments
.env
.venv
env/
venv/
ENV/
env.bak/
venv.bak/
# ml-environment

# Spyder project settings
.spyderproject
.spyproject
artifacts

# Rope project settings
.ropeproject

# mkdocs documentation
/site

# mypy
.mypy_cache/
.dmypy.json
dmypy.json

# Pyre type checker
.pyre/

# pytype static type analyzer
.pytype/

# Cython debug symbols
cython_debug/

# PyCharm
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Aman Kumar

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# End-to-End-Image-Classification-MLOPS-implementation

<img src="project-image.png">



23 changes: 23 additions & 0 deletions config/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
artifacts_root: artifacts

data_ingestion:
root_dir: data
source_URL: https://github.com/Aman123lug/Data-storage-for-all-projects/raw/main/Chicken-fecal-images.zip
local_data_file: artifacts/data_ingestion/data.zip
unzip_dir: artifacts/data_ingestion

prepare_base_model:
root_dir: artifacts/prepare_base_model
base_model_config: artifacts/prepare_base_model/base_model.h5
updated_base_model_config: artifacts/prepare_base_model/base_model_updated.h5


prepare_callbacks:
root_dir: artifacts/prepare_callbacks
tensorboard_root_log_dir: artifacts/prepare_callbacks/tensorboard_root_log_dir
checkpoint_model_filepath: artifacts/prepare_callbacks/checkpoint_root_log_dir/model.h5


training:
root_dir: artifacts/training
train_model_path: artifacts/training/model.h5
58 changes: 58 additions & 0 deletions dvc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
stages:
data_ingestion:
cmd: python src/cnnClassifier/pipline/stage_01_data_ingestion.py
deps:
- src/cnnClassifier/pipline/stage_01_data_ingestion.py
- config/config.yaml
outs:
- data/Chicken-fecal-images

prepare_base_model:
cmd: python src/cnnClassifier/pipline/stage_02_prepare_base_model.py
deps:
- src/cnnClassifier/pipline/stage_02_prepare_base_model.py
- config/config.yaml

params:
- IMAGE_SIZE
- INCLUDE_TOP
- CLASSES
- WEIGHTS
- LEARNING_RATE

outs:
- artifacts/prepare_base_model


training:
cmd: python src/cnnClassifier/pipline/stage_03_training.py
deps:

- src/cnnClassifier/pipline/stage_03_training.py
- src/cnnClassifier/components/prepare_callbacks.py
- config/config.yaml
- data/Chicken-fecal-images
- artifacts/prepare_base_model

params:
- EPOCH
- BATCH_SIZE
- IMAGE_SIZE
- AUGMENTATION

outs:
- artifacts/training/model.h5

model_evaluation:
cmd: python src/cnnClassifier/pipline/stage_04_evaluation.py
deps:
- src/cnnClassifier/pipline/stage_04_evaluation.py
- config/config.yaml
- data/Chicken-fecal-images
- artifacts/training/model.h5
params:
- IMAGE_SIZE
- BATCH_SIZE
metrics:
- score.josn:
cache: false
51 changes: 51 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
from src.cnnClassifier.loggerr import logger
from src.cnnClassifier.pipline.stage_01_data_ingestion import DataIngestionTrainingPipeline
from src.cnnClassifier.pipline.stage_02_prepare_base_model import PrepareBaseModelTrainingPipeline
from src.cnnClassifier.pipline.stage_03_training import ModelTrainingPipeline
from src.cnnClassifier.pipline.stage_04_evaluation import ModelEvaluation

STAGE_NAME = "Data Ingestion"
try:
logger.info(f" <<<< stage {STAGE_NAME} <<<< started")
data_ingestion = DataIngestionTrainingPipeline()
data_ingestion.main()
logger.info(f" <<<< stage {STAGE_NAME} >>>> completed !")

except Exception as e:
# logger.exception(e)
raise e

STAGE_NAME = "Prepare Base Model"
try:
logger.info(f" <<<< stage {STAGE_NAME} <<<< started")
base_model = PrepareBaseModelTrainingPipeline()
base_model.main()
logger.info(f" <<<< stage {STAGE_NAME} >>>> completed !")

except Exception as e:
logger.exception(e)
raise e


STAGE_NAME = "Training"
try:
logger.info(f"<<<< stage {STAGE_NAME} started >>>>")
train = ModelTrainingPipeline()
train.main()
logger.info(f"<<<< stage {STAGE_NAME} completed >>>>")

except Exception as e:
logger.exception(e)
raise e


STAGE_NAME = "Model Evaluation"
try:
logger.info(f"<<<< Stage {STAGE_NAME} started")
evaluate = ModelEvaluation()
evaluate.main()
logger.info(f"<<<< stage {STAGE_NAME} completed >>>>")

except Exception as e:
logger.exception(e)
raise e
11 changes: 11 additions & 0 deletions params.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
AUGMENTATION: True
IMAGE_SIZE: [224, 224, 3]
BATCH_SIZE: 16
INCLUDE_TOP: False
EPOCH: 1
LEARNING_RATE: 0.01
CLASSES: 2
WEIGHTS: imagenet



Binary file added project-image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
scikit-learn
tensorflow
dvc
pandas
numpy
notebook
matplotlib
seaborn
python-box==6.0.2
pyYAML
tqdm
ensure==1.0.2
joblib
spacy
Flask
Flask-Cors

-e .
Loading

0 comments on commit e00a760

Please sign in to comment.