Awesome
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 preparation module consisting of reading and transforming data. All data store indata
data.txt
andlabel.txt
with some predefined format explained below. -
scripts to build multi-label classifier model. Your model templets should put here.model
-
train test and visualization options define hereoptions
-
util
webvisualizer
: a visdom based visualization tool for visualizing loss and accuracy of each attributeutil
: miscellaneous functions used in projecthtml
: 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 currentattribute
:
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. Combineimage_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 inlabel.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: