This project implements a multiclass image classification pipeline using a pretrained MobileNet-V2 neural network model. The pipeline includes preprocessing, processing, and postprocessing steps, all orchestrated using Makefiles and Docker for ease of deployment and reproducibility.
- Aibek Akhmetkazy
- Hassan Iftikhar
- Aleksandr Kukharskii
- Rinat Prochii
- Docker
-
Clone the Repository:
git clone https://github.com/AlKukharskii/fse4ai_team_2.git cd fse4ai_team_2 -
In Dockerfile, comment RUN make test, if you do not want to run tests
vim Dockerfile
-
Build the Docker Image:
docker build -t classifier . -
Run Docker: Install dependencies and compile necessary components:
docker run -it --rm -v "$(pwd)"/input_raw:/usr/src/app/input_raw -v "$(pwd)"/output:/usr/src/app/output -e INPUT_DIR=input_raw classifier
The project provides two Makefiles:
This Makefile is used to compile all binary executables and/or libraries necessary for the project. The Dockerfile relies on this Makefile to build the project inside a Docker image. It includes the following targets:
- all: Installs all dependencies and compiles all executables, i.e. steps prereqs and build.
- prereqs: Installs all dependencies, compiles, and installs necessary components.
- build: Compiles all necessary executables, including preprocessing (
preprocessing.out) and postprocessing (postprocessing.out) executables. - test: Tests all steps of the pipeline, including verifying the correctness of preprocessing, processing, and postprocessing.
- clean: Clean target to remove built files or unnecessary directories.
This Makefile serves as an entry point for running the pipeline in the Docker container. It orchestrates the following steps:
- preprocess: Converts all files in
/input_rawto a standardized format in/input. - inference: Uses the neural network model to classify images from
/inputand writes results to/output_raw. - postprocess: Annotates images using results from
/output_rawand saves them in/output. - run: Run the whole pipeline, i.e. it will execute preprocess, then inference, and, finally, postprocess.
- Input: The input is a raw image (
image.jpg), which is first downscaled to224x224pixels in the preprocessing step. - Output: The processed output consists of the predicted class label saved in
output_prediction.txt, and the postprocessed output is the annotated image (image_with_label.jpg).
The repository includes a GitHub Actions workflow that automates the building and testing of the Docker image. This ensures that all commits and pull requests pass the make prereqs, make build, and make test stages.
Acknowledgments to data sources, libraries, and frameworks used in this project, such as:
- MobileNet-V2 for the pretrained model architecture.
- Docker for containerization, ensuring a consistent runtime environment.
- PyTorch for model implementation and training.
- OpenCV for image preprocessing and handling.
- Ubuntu 20.04 as the base environment for building the project.
- GNU Make for orchestrating the build, test, and run processes.
- GitHub Actions for providing CI/CD for building and testing the project.