Skip to content

A pytorch implemented classifier for Multiple-Label classification

Notifications You must be signed in to change notification settings

pangwong/pytorch-multi-label-classifier

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pytorch-multi-label-classifier

Introdution

A pytorch implemented classifier for Multiple-Label classification. You can easily train, test your multi-label classification model and visualize the training process.
Below is an example visualizing the training of one-label classifier. If you have more than one attributes, no doubt that all the loss and accuracy curves of each attribute will show on web browser orderly.

Loss Accuracy

Module

  • data

    data preparation module consisting of reading and transforming data. All data store in data.txtand label.txt with some predefined format explained below.
  • model

    scripts to build multi-label classifier model. Your model templets should put here.
  • options

    train test and visualization options define here
  • util

    • webvisualizer: a visdom based visualization tool for visualizing loss and accuracy of each attribute
    • util: miscellaneous functions used in project
    • html: used in webvisualizer.
  • test

    • mnist: mnist dataset arranged as defined data format.
    • celeba: exactract some of attributes of CelebA dataset

Multi-Label Data Format

Data Format Explanation.

  • label.txt

 Store attribute information including its name and value. label.txt example. Lines in label.txt stack as follows:

  • For each attribute :
    • number of attribute values ; id of attribute ; name attribute
    • For each attribute value belonging to current attribute :
      • id of attibute_value ; name of attribute value

 Note: mind the difference between attribute and attribute value.

  • data.txt

 Store objects information including attribute id and bounding box and so on. Each line is one json dict recording one object. data.txt example  

  • "box":object boundingbox. 'x': top_left.x , 'y':top_left.y, 'w': width of box, 'h': height of box.
  • "image_id": image identifier. An image content dependent hash value.
  • "box_id": object identidier. Combine image_id, box['x'], box['y'], box['w'], box["h"] with _.
  • "size": image width and height. Used for varifying whether box is valid.
  • "id": list of ids. Store multi-label attributes ids, the order is the same as the attributes' order in label.txt

Dependence

  • Visdom 0.1.7.2
  • Pytorch 0.3.1.post2

TODO

  • Snapshot loss and accuracy records
  • Support visualize multi top K accuracy
  • Support model finetuning
  • Complete test module
  • Add switch to control loss and accuracy curves displaying on one plot or multiple
  • Train and Test Log

Reference

Part of codes and models refer to some other OSS listed below for thanks:

About

A pytorch implemented classifier for Multiple-Label classification

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published