Giter VIP home page Giter VIP logo

binary-image-classification-with-celeba-dataset's Introduction

Binary Image Classifier and Organize CelebA Dataset!

Hi! In this project, I will guide you to organize CelebA dataset for each attributes and build binary image classifier in PyTorch.

Steps

I will follow 3 steps;

1. Organize Data

2. Train Model

3. Model Usage

Organize Data

Firstly, we need to download CelebA Align&Cropped Images from here. Also, we will download the list_attr_celeba.csv file here to prepare dataset using the features. You need to place both of these folder to root. In csv file, -1 and 1 means that attributes status. In this project, I chose the beard and mustache as an attributes. You can change them in the project you will do yourself. If you want to change, you can modify OrganizeAttributes.py file. Then run the file. Our train dataset ready. We will place both Yes and No folders into one training folder. Then we will create our test data with using OrganizeTest.py file. I selected 2000 test data for each Yes and No folder. You can modify your own. Finally our train and test datasets are ready.

Create Network

Now, we will create our network in BinaryClassifier.py file. There are some parameters that you can modify. I used my owns. Also, you can modify network with respect to your project. When you run file, you will see the summary of models. In my computer, I have GTX 1050Ti and training starting in almost 200 seconds.

Epoch 1/50, Training Loss: 0.417, Training Accuracy: 84.000, Testing Loss: 0.034, Testing Acc: 50.000, Time: 245.3589s
Epoch 2/50, Training Loss: 0.382, Training Accuracy: 84.000, Testing Loss: 0.023, Testing Acc: 58.000, Time: 231.649s

Model Usage

After training finished, we will try to use our model for classification. I am going to use MTCNN for detect face and cropping bounding box before insert image into model. In UseClassifier.py we insert input image to model for prediction.

Requirements

  • Torch
  • Torchvision
  • Matplotlib
  • Numpy
  • MTCNN
  • Opencv-Python
  • Pillow
  • Pandas

pip install -r requirements.txt

Final

Your folder should be like image;

Folder

binary-image-classification-with-celeba-dataset's People

Contributors

cengizhanyurdakul avatar

Stargazers

 avatar

Watchers

 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.