Giter Site home page Giter Site logo

mlclassification's Introduction

Image Classification of Hotels and Non-Hotels

This project is carried out for the purpose of building a machine learning model for classifying images of Hotes from Non-hotels

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Project Structure

.
├── datasets
│   ├── test_set
│   │   ├── hotels
│   │   └── not-hotels
│   │            
│   │             
│   └── training_set
├       ├── hotels
├       └── not-hotels
├── model
│   └── default_model.h5
│   
│   
├── utils
├── requirements.txt
├── app.py
└── README.md

Prerequisites

Python distribution

Anaconda

Installing

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

Deployment

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

Train App

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

APIs

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

Built With

Documentation

Read documentation here

License

This project is licensed under the MIT License - see the LICENSE file for details

Acknowledgments

  • Hat tip to anyone whose code was used
  • Inspiration
  • etc

mlclassification's People

Contributors

5iga avatar akinduko avatar babageedhey avatar believeohiozua avatar cornzyblack avatar danieletukudo avatar dannyml-dsc avatar darichcastle avatar emkaydauda avatar ephraimbuddy avatar geekyadams avatar haksoat avatar ibnahmadbello avatar josh4324 avatar kayceedev avatar kene111 avatar louiseyoma avatar lpmatrix avatar mrdvince avatar olumidesan avatar oranyenonso avatar parakconcepts avatar secjedi avatar the-indigo avatar tooluloope avatar tosi-n avatar udohsolomon avatar vahiwe avatar yomaokobiah avatar yourfavouriteoreo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mlclassification's Issues

No Dataset

cannot find the dataset using the project structure given in the readme file,

More arguments to console app

Currently, typing this on command line:

python app.py train

Uses the default datasets to train model. I want to add this :

python app.py train -trp train_path -tep test path

This will enable us to accept training data folder as well as test data folder.

If we type:

python app.py train

Without specifying any folder, it'll default to using ./datasets/training_set and ./datasets/test_set for training and test data set we provided

For this task, I'll be working on app.py and utils/train_model.py

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.