This project is carried out for the purpose of building a machine learning model for classifying images of Hotes from Non-hotels
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
.
├── datasets
│ ├── test_set
│ │ ├── hotels
│ │ └── not-hotels
│ │
│ │
│ └── training_set
├ ├── hotels
├ └── not-hotels
├── model
│ └── default_model.h5
│
│
├── utils
├── requirements.txt
├── app.py
└── README.md
Python distribution
Anaconda
Install Anaconda python distribution on your system
Create a virtual environment called env.
python -m venv env
Activate the virtual environment
LINUX/Mac: source env/bin/activate
Windows: env\Scripts\activate
Upgrade to the latest pip
pip install --upgrade pip
Install dependencies using requirements file
pip install -r requirements.txt
Note: Your virtual environment must always be activated before running any command
Start app
npm install && npm start
Example of valid commands
python app.py predict --path kimono-1986491_640.jpg
python app.py predict --path predict
Make sure you have a dataset folder with the below structure in the root folder of the app
A trained model weight file can be found here, download and put it in the models folder.
Download and extract this file to the root folder of the project or you can train your own model by providing a dataset folder in the root folder of the project with below structure.
.
├── datasets
│ ├── test_set
│ │ ├── valid_case
│ │ └── not_valid_case
│ │
│ │
│ └── training_set
├ ├── valid_case
├ └── not_valid_case
This are command options in full:
A command line utility for image classification.
-----------------------------------------------
These are common commands for this app.
positional arguments:
app_action This can either be predict, train, retrieve_models or
delete
optional arguments:
-h, --help show this help message and exit
-path PATH, --path PATH
A path to a folder or image e.g foo or foobar.jpg
-grpA GRPA, --grpA GRPA
A group A folder path e.g hotels
-grpB GRPB, --grpB GRPB
A group B folder path e.g not-hotels
-model MODEL, --model MODEL
Selects a model to be used
-gen_name GEN_NAME, --gen_name GEN_NAME
A boolean to generate model name e.g yes or no
Below is specifics
Retrieve Models:
python app.py retrieve_models
Delete Model:
python app.py delete -model modelname
or:
python app.py delete --model modelname
Train Model with custom dataset and model:
python app.py train --grpA path/to/groupA --grpB path/to/groupB --model cat_dogmodel
or:
python app.py train -grpA path/to/groupA -grpB path/to/groupB -model cat_dogmodel
Train with default dataset and model:
If the default model already exists, delete it before proceeding
python app.py train
Classification with default model:
with image file:
python app.py predict --path /path/to/image.png
with folder:
python app.py predict --path /path/to/folder
or:
with image file:
python app.py predict -path /path/to/image.png
with folder:
python app.py predict -path /path/to/folder
Classification with custom model:
python app.py predict --path /Users/src/assets/images/bg.png --model modelname
or:
python app.py predict -path /Users/src/assets/images/bg.png -model modelname
Read documentation here
This project is licensed under the MIT License - see the LICENSE file for details
- Hat tip to anyone whose code was used
- Inspiration
- etc