Code Monkey home page Code Monkey logo

mv's Introduction

Table of Contents

Setup

Download

  • Currently using submodule keras-YOLOv3-model-set
    # Clone this repository
    git clone git://github.com/CSenshi/MV.git
    
    # Change directory to repository
    cd MV
    
    # Download keras submodule
    # destination directory: $(pwd)/YOLO
    git submodule update --init --recursive

Virtual Environment (venv)

  • Create venv

    python3 -m venv ./venv
  • Activate venv

    source venv/bin/activate
  • Install

    sudo apt install python3-opencv
    pip install Cython
    pip install -r requirements.txt
  • Deactivate venv

    deactivate

Jupyter Notebook

  • Download Weights

    # change direcotry to keras-yolo submodule
    cd YOLO
    
    # Download Weights
    wget -O weights/yolov3-tiny.weights https://pjreddie.com/media/files/yolov3-tiny.weights
    
    # Convert to teras weights
    python  tools/model_converter/convert.py \
            cfg/yolov3-tiny.cfg \
            weights/yolov3-tiny.weights \
            weights/yolov3-tiny.h5
  • Run Jupyter Notebook

    jupyter notebook

Error while rendering notebook on github?

  • It seems notebook rendering is problem in github. Try reloading few times, if problem still occures please open it via following link:
    https://nbviewer.jupyter.org/

Car Classifier

script detect_car_color.ipynb is responsible for clasifying each car's pictures as interior or exterior.

Before running script:

  ...
  ├── 45976134
  ├── 45976135
  │   ├── 1.jpg
  │   ├── 2.jpg
  │   ├── 3.jpg
  │   ├── 4.jpg
  │   ├── 5.jpg
  │   ├── 6.jpg
  │   └── 7.jpg
  ├── 45976136
  ...

After script execution:

...
├── 45976134
├── 45976135
│   ├── exterior
│   │   ├── 2.jpg
│   │   ├── 5.jpg
│   │   ├── 6.jpg
│   │   └── 7.jpg
│   └── interior
│       ├── 1.jpg
│       ├── 3.jpg
│       └── 4.jpg
├── 45976136
...

HomeWork

As for homework I took 3 exercises to work on

  1. Doors
  2. Car Category
  3. Car Color

For all of those exerises I wrote one generic script that would work on all the given problems, with slight changes. As for model I created new model class that is subclass of nn.Module and as for base model I used resnet18.

Model

  • Why Resnet?

    As for base model I had to choose between many models, but finally decided to choose between 3 models: Resnet, VGG, Densnet. I tried all of those model and results showed that VGG performs poorly (expected better results), so i had to throw it away. as for Densnet it is great model, but it was taking a lot of time, but model result wasn't as different as elapsed time for each model. So I choose to stay with model that takes small time (RESNET).

  • Why 18 layers?

    Resnet comes with 18, 34, 50, 101 and 152 layers. As results showed prediction is getting better only after 50 layers, but as it was in modeling, there is downside of time. It takes a lot of time than resnet 18, but for 34 layer it didn't act as good as i expeted. So after many tests I decided to stick with Resnet model with 18 layers, which is enough for given problems

Loss

As for loss function I used torch.nn.CrossEntropyLoss(), This criterion combines nn.LogSoftmax() and nn.NLLLoss() in one single class (softmax is a MUST for this problem because we are having problem with multiple classes).

Optimizers

  • Gradient

    for gradient descent I used Stochastic Gradient Descent (SGD) from torch.optim. so if you use a typical Gradient Descent optimization technique on big data(samples), you will have to use all of the samples for completing one iteration while performing the Gradient Descent, and it has to be done for every iteration until the minima is reached. Hence, it becomes computationally very expensive to perform. In SGD, it uses only a single sample, i.e., a batch size of one, to perform each iteration. The sample is randomly shuffled and selected for performing the iteration.

  • Scheduler

    torch.optim.lr_scheduler provides several methods to adjust the learning rate based on the number of epochs.

mv's People

Contributors

csenshi avatar dependabot[bot] avatar

Watchers

 avatar  avatar

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.