Code repository for Self-supervised Structure-sensitive Learning, CVPR'17

Overview

Self-supervised Structure-sensitive Learning (SSL)

Ke Gong, Xiaodan Liang, Xiaohui Shen, Liang Lin, "Look into Person: Self-supervised Structure-sensitive Learning and A New Benchmark for Human Parsing", CVPR 2017.

Introduction

SSL is a state-of-the-art deep learning methord for human parsing built on top of Caffe. This novel self-supervised structure-sensitive learning approach can impose human pose structures into parsing results without resorting to extra supervision (i.e., no need for specifically labeling human joints in model training). The self-supervised learning framework can be injected into any advanced neural networks to help incorporate rich high-level knowledge regarding human joints from a global perspective and improve the parsing results.

This distribution provides a publicly available implementation for the key model ingredients reported in our latest paper which is accepted by CVPR2017.

We newly introduce a novel Joint Human Parsing and Pose Estimation Network (JPPNet), which is accepted by T-PAMI 2018. (Paper and Code)

Please consult and consider citing the following papers:

@InProceedings{Gong_2017_CVPR,
  author = {Gong, Ke and Liang, Xiaodan and Zhang, Dongyu and Shen, Xiaohui and Lin, Liang},
  title = {Look Into Person: Self-Supervised Structure-Sensitive Learning and a New Benchmark for Human Parsing},
  booktitle = {The IEEE Conference on Computer Vision and Pattern Recognition (CVPR)},
  month = {July},
  year = {2017}
}
@article{liang2018look,
  title={Look into Person: Joint Body Parsing \& Pose Estimation Network and a New Benchmark},
  author={Liang, Xiaodan and Gong, Ke and Shen, Xiaohui and Lin, Liang},
  journal={IEEE Transactions on Pattern Analysis and Machine Intelligence},
  year={2018},
  publisher={IEEE}
}

Look into People (LIP) Dataset

The SSL is trained and evaluated on our LIP dataset for human parsing. Please check it for more model details. The dataset is also available at google drive and baidu drive.

Pre-trained models

We have released our trained models with best performance at google drive and baidu drive.

Train and test

  1. Download LIP dataset or prepare your own data.
  2. Put the images(.jpg) and segmentations(.png) into ssl/human/data/images and ssl/human/data/labels
  3. Put the train, val, test lists into ssl/human/list. Each type contains a list for path and a list for id (e.g., train.txt and train_id.txt)
  4. Download the pre-trained model and put it into ssl/human/model/attention/. You can also refer DeepLab for more models.
  5. Set up your init.caffemodel before training and test.caffemodel before testing. You can simply use a soft link.
  6. The prototxt files for network config are saved in ssl/human/config
  7. In run_human.sh, you can set the value of RUN_TRAIN adn RUN_TEST to train or test the model.
  8. After you run TEST, the computed features will be saved in ssl/human/features. You can run the provided MATLAB script, show.m to generate visualizable results. Then you can run the Python script, test_human.py to evaluate the performance.

Related work

  • Joint Body Parsing & Pose Estimation Network JPPNet, T-PAMI2018
  • Instance-level Human Parsing via Part Grouping Network PGN, ECCV2018
  • Graphonomy: Universal Human Parsing via Graph Transfer Learning Graphonomy, CVPR2019
Comments
  • Error in Training

    Error in Training

    It's an amazing work, I just follow your step, and your pretrained model performs quite well in the Testset. But when I start training in training and val set by finetuning your pretrained model, I met this error:

    I0516 17:22:28.534246 34577 layer_factory.hpp:77] Creating layer data I0516 17:22:28.534312 34577 net.cpp:106] Creating Layer data I0516 17:22:28.534332 34577 net.cpp:411] data -> data I0516 17:22:28.534373 34577 net.cpp:411] data -> label I0516 17:22:28.534395 34577 net.cpp:411] data -> (automatic) I0516 17:22:28.534835 34577 image_seg_data_layer.cpp:46] Opening file human/list/train.txt I0516 17:22:28.566068 34577 image_seg_data_layer.cpp:63] Shuffling data I0516 17:22:28.569484 34577 image_seg_data_layer.cpp:68] A total of 40462 images. I0516 17:22:28.584575 34577 image_seg_data_layer.cpp:137] output data size: 1,3,321,321 I0516 17:22:28.584602 34577 image_seg_data_layer.cpp:141] output label size: 1,1,321,321 I0516 17:22:28.584614 34577 image_seg_data_layer.cpp:145] output data_dim size: 1,1,1,2 I0516 17:22:28.594056 34577 net.cpp:150] Setting up data I0516 17:22:28.594171 34577 net.cpp:157] Top shape: 1 3 321 321 (309123) I0516 17:22:28.594243 34577 net.cpp:157] Top shape: 1 1 321 321 (103041) I0516 17:22:28.594271 34577 net.cpp:157] Top shape: 1 1 1 2 (2) I0516 17:22:28.594316 34577 net.cpp:165] Memory required for data: 1648664 I0516 17:22:28.594347 34577 layer_factory.hpp:77] Creating layer data_data_0_split I0516 17:22:28.594403 34577 net.cpp:106] Creating Layer data_data_0_split I0516 17:22:28.594442 34577 net.cpp:454] data_data_0_split <- data I0516 17:22:28.594481 34577 net.cpp:411] data_data_0_split -> data_data_0_split_0 I0516 17:22:28.594521 34577 net.cpp:411] data_data_0_split -> data_data_0_split_1 I0516 17:22:28.594554 34577 net.cpp:411] data_data_0_split -> data_data_0_split_2 I0516 17:22:28.594708 34577 net.cpp:150] Setting up data_data_0_split I0516 17:22:28.594743 34577 net.cpp:157] Top shape: 1 3 321 321 (309123) I0516 17:22:28.594769 34577 net.cpp:157] Top shape: 1 3 321 321 (309123) I0516 17:22:28.594792 34577 net.cpp:157] Top shape: 1 3 321 321 (309123) I0516 17:22:28.594813 34577 net.cpp:165] Memory required for data: 5358140 I0516 17:22:28.594836 34577 layer_factory.hpp:77] Creating layer label_data_1_split I0516 17:22:28.594862 34577 net.cpp:106] Creating Layer label_data_1_split I0516 17:22:28.594884 34577 net.cpp:454] label_data_1_split <- label I0516 17:22:28.594910 34577 net.cpp:411] label_data_1_split -> label_data_1_split_0 I0516 17:22:28.594944 34577 net.cpp:411] label_data_1_split -> label_data_1_split_1 I0516 17:22:28.595024 34577 net.cpp:150] Setting up label_data_1_split I0516 17:22:28.595055 34577 net.cpp:157] Top shape: 1 1 321 321 (103041) I0516 17:22:28.595078 34577 net.cpp:157] Top shape: 1 1 321 321 (103041) I0516 17:22:28.595098 34577 net.cpp:165] Memory required for data: 6182468 I0516 17:22:28.595119 34577 layer_factory.hpp:77] Creating layer shrink_data05 I0516 17:22:28.595193 34577 net.cpp:106] Creating Layer shrink_data05 I0516 17:22:28.595221 34577 net.cpp:454] shrink_data05 <- data_data_0_split_0 I0516 17:22:28.595247 34577 net.cpp:411] shrink_data05 -> shrink_data05 I0516 17:22:28.595319 34577 net.cpp:150] Setting up shrink_data05 I0516 17:22:28.595353 34577 net.cpp:157] Top shape: 1 3 161 161 (77763) I0516 17:22:28.595376 34577 net.cpp:165] Memory required for data: 6493520 I0516 17:22:28.595396 34577 layer_factory.hpp:77] Creating layer shrink_data075 I0516 17:22:28.595424 34577 net.cpp:106] Creating Layer shrink_data075 I0516 17:22:28.595445 34577 net.cpp:454] shrink_data075 <- data_data_0_split_1 I0516 17:22:28.595471 34577 net.cpp:411] shrink_data075 -> shrink_data075 I0516 17:22:28.595533 34577 net.cpp:150] Setting up shrink_data075 I0516 17:22:28.595563 34577 net.cpp:157] Top shape: 1 3 241 241 (174243) I0516 17:22:28.595584 34577 net.cpp:165] Memory required for data: 7190492 I0516 17:22:28.595628 34577 layer_factory.hpp:77] Creating layer conv1_1 I0516 17:22:28.595676 34577 net.cpp:106] Creating Layer conv1_1 I0516 17:22:28.595702 34577 net.cpp:454] conv1_1 <- data_data_0_split_2 I0516 17:22:28.595729 34577 net.cpp:411] conv1_1 -> conv1_1 E0516 17:22:28.599076 34580 io.cpp:81] Could not open or find file human/data/ F0516 17:22:28.599761 34580 data_transformer.cpp:475] Check failed: img_height == seg_height (246 vs. 0) *** Check failure stack trace: *** @ 0x7f6489caddaa (unknown) @ 0x7f6489cadce4 (unknown) @ 0x7f6489cad6e6 (unknown) @ 0x7f6489cb0687 (unknown) @ 0x7f648a31d77d caffe::DataTransformer<>::TransformImgAndSeg() @ 0x7f648a442c51 caffe::ImageSegDataLayer<>::load_batch() @ 0x7f648a453acc caffe::BasePrefetchingDataLayer<>::InternalThreadEntry() @ 0x7f648a351d80 caffe::InternalThread::entry() @ 0x7f64818afa4a (unknown) @ 0x7f647d414184 start_thread @ 0x7f648908a37d (unknown) @ (nil) (unknown)

    Any advice would be nice : )

    opened by CPFLAME 13
  • Incorrect output in test

    Incorrect output in test

    Hi!

    I'm trying to use your code to get segmentations. In my input images there is usually one rather large person. But output segmentation mask is always filled with fives.

    Can you tell me what I'm doing wrong?

    opened by mzemlyanikin 11
  • Is it impossible to train with new data for sketch-segmentation?

    Is it impossible to train with new data for sketch-segmentation?

    Hi. I want to apply this model on sketch-segmentation. It means my input is sketch and my expected output is segmented image of sketch. Is it impossible to apply this model on my new data? and what will i need to change in config to correct my training. So far my result was wrong. Thanks

    opened by codaibk 8
  • what's type of the segmentation images in training data?

    what's type of the segmentation images in training data?

    Hi, The train segmentations data is gray scale images or black and white image? I though the segmentations will have 20 colors corresponding to 20 labels. This is one of segmented image in your training data. 77_471474 Thanks

    opened by codaibk 7
  • Error in testing with pretrained model

    Error in testing with pretrained model

    I am trying to test with the pre-trained model available in the readme.

    Downloaded the LIP dataset and placed the images, segmentations and list as specified Downloaded the caffemodel and renamed it as test.caffemodel

    I have existing caffe in my machine (windows 7 64 bit) and using the same for testing. Changed the path in run_human.sh Getting the following error when running the run_human.sh

    Testing net human/attention
    Running D://Projects//caffe//tools//Release//caffe.exe test --model=human/config/attention/test_val.prototxt --weights=human/model/attention/test.caffemodel --gpu=0 --iterations=1
    I0404 20:37:13.862496  9404 caffe.cpp:276] Use GPU with device ID 0
    I0404 20:37:13.940496  9404 caffe.cpp:280] GPU device name: GeForce GT 720
    I0404 20:37:14.190094  9404 common.cpp:36] System entropy source not available, using fallback algorithm to generate seed instead.
    [libprotobuf ERROR C:\Users\guillaume\work\caffe-builder\build_v120_x64\packages\protobuf\protobuf_download-prefix\src\protobuf_download\src\google\protobuf\text_format.cc:298] Error parsing text-format caffe.NetParameter: 14:15: Message type "caffe.ImageDataParameter" has no field named "label_type".
    *** Check failure stack trace: ***
    
    opened by bhalajin 6
  • out of memory issue using GTX1080

    out of memory issue using GTX1080

    I0524 00:14:45.317162 21868 net.cpp:816] Ignoring source layer accuracy_first_res1 I0524 00:14:45.317179 21868 net.cpp:816] Ignoring source layer loss_first_res075 I0524 00:14:45.317183 21868 net.cpp:816] Ignoring source layer accuracy_first_res075 I0524 00:14:45.317186 21868 net.cpp:816] Ignoring source layer label_shrink16 I0524 00:14:45.317189 21868 net.cpp:816] Ignoring source layer label_shrink16_label_shrink16_0_split I0524 00:14:45.317193 21868 net.cpp:816] Ignoring source layer loss_first_res05 I0524 00:14:45.317195 21868 net.cpp:816] Ignoring source layer accuracy_first_res05 I0524 00:14:45.319630 21868 caffe.cpp:252] Running for 9999 iterations. F0524 00:14:45.558805 21868 syncedmem.cpp:56] Check failed: error == cudaSuccess (2 vs. 0) out of memory *** Check failure stack trace: *** @ 0x7f0562f8cdaa (unknown) @ 0x7f0562f8cce4 (unknown) @ 0x7f0562f8c6e6 (unknown) @ 0x7f0562f8f687 (unknown) @ 0x7f056379ae91 caffe::SyncedMemory::to_gpu() @ 0x7f056379a1f9 caffe::SyncedMemory::mutable_gpu_data() @ 0x7f0563784822 caffe::Blob<>::mutable_gpu_data() @ 0x7f05636ebe88 caffe::BaseConvolutionLayer<>::forward_gpu_gemm() @ 0x7f05637aa9b6 caffe::ConvolutionLayer<>::Forward_gpu() @ 0x7f0563726831 caffe::Net<>::ForwardFromTo() @ 0x7f0563726ba7 caffe::Net<>::ForwardPrefilled() @ 0x406d74 test() @ 0x4059dc main @ 0x7f0562297f45 (unknown) @ 0x406111 (unknown) @ (nil) (unknown) run_human.sh: line 82: 21868 Aborted (core dumped) ${CMD}

    Hi, I'm using GTX1080, it seems like I face cuda memory issue if all my setting is good. Have you tried on GTX 1080 and is it possible that I make batch size smaller?

    opened by adwin5 6
  • error Class_id

    error Class_id

    Hi author,

    Thanks for your projects, I have problem with your LIPS dataset (image + mask): As you can see I show this image (LIP/TrainVal_images/TrainVal_images/train_images/124117_202251.jpg): class_id = [ 2 5 13 14 15] image

    LIP/TrainVal_images/TrainVal_images/train_images/124122_1735422.jpg: class_id = [ 2 5 8 9 13 17] image

    LIP/TrainVal_images/TrainVal_images/train_images/12413_1224729.jpg class_id = [ 1 2 7 9 14 18 19] image

    I have follow your id class but maybe it is not right: 1.Hat 2.Hair 3.Sunglasses 4.Upper-clothes 5.Dress 6.Coat 7.Socks 8.Pants 9.Glove 10.Scarf 11.Skirt 12.Jumpsuits 13.Face 14.Right-arm 15.Left-arm 16.Right-leg 17.Left-leg 18.Right-shoe 19.Left-shoe

    Please help me

    Thanks Nam

    opened by vitiennam 4
  • "Check failed: matfp Error creating MAT file" during test process

    When I test the model, I got this errror when I run ./run_human.sh.

    How should I deal with this problem?

    ...
    ...
    F0912 10:56:18.593981  8397 matio_io.cpp:66] Check failed: matfp Error creating MAT file human/features/attentional/fc8_mask/labels/1270_1715217.png_blob_0.mat
    *** Check failure stack trace: ***
        @     0x7fac995ea5cd  google::LogMessage::Fail()
        @     0x7fac995ec433  google::LogMessage::SendToLog()
        @     0x7fac995ea15b  google::LogMessage::Flush()
        @     0x7fac995ece1e  google::LogMessageFatal::~LogMessageFatal()
        @     0x7fac99e17a7b  caffe::WriteBlobToMat<>()
        @     0x7fac99dc1092  caffe::MatWriteLayer<>::Forward_cpu()
        @     0x7fac99e46886  caffe::Net<>::ForwardFromTo()
        @     0x7fac99e46c47  caffe::Net<>::ForwardPrefilled()
        @           0x409115  test()
        @           0x4075c8  main
        @     0x7fac9809e830  __libc_start_main
        @           0x407d39  _start
        @              (nil)  (unknown)
    Aborted (core dumped)
    
    opened by lijiaqi 4
  • test pretrain model with customized data

    test pretrain model with customized data

    Hi @Engineering-Course , thank you for the great project, I''ve successfully compiled ur caffe version and try to execute run_human.sh, but it prompts the error in image transformer processing. data_transformer.cpp:474] Check failed: img_channels == data_channels (1 vs. 3) However I follow your instruction to make a val.txt to construct my testing image list. the sample in my txt file such as /images/23454.jpg /images/3534.jpg all of them are 3 channel RGB images, but still I got this error , may I ask about the reason? seems like img_channels should also be 3? Thank you if you can check this for me.

    opened by Anguliachao 3
  • "caffe.ImageDataParameter" has no field named "label_type"

    Hello! I get this error when trying to test the pretrained model. Could you help me figure it out please?

    Testing net human/attention
    Running /usr/bin/caffe.bin test              --model=human/config/attention/test_val.prototxt              --weights=human/model/attention/test.caffemodel              --iterations=10000
    I1121 16:58:08.414149 24292 caffe.cpp:284] Use CPU.
    [libprotobuf ERROR google/protobuf/text_format.cc:307] Error parsing text-format caffe.NetParameter: 14:15: Message type "caffe.ImageDataParameter" has no field named "label_type".
    F1121 16:58:08.419540 24292 upgrade_proto.cpp:88] Check failed: ReadProtoFromTextFile(param_file, param) Failed to parse NetParameter file: human/config/attention/test_val.prototxt
    

    I believe the key part is this: "caffe.ImageDataParameter" has no field named "label_type".

    This looks related to #22, but since that thread is closed with no posted solution, I'm opening a new issue. Thank you for your time.

    opened by andrewjong 3
  • error

    error

    In the process of training, I met this error: F0307 17:08:57.373412 27727 data_transformer.cpp:475] Check failed: img_height == seg_height (409 vs. 0)

    I don't know how to solve it, could you please give me some suggestions? Thank you very much!

    opened by YOKE 3
  • Test results are consistent with the reported values in the paper ?

    Test results are consistent with the reported values in the paper ?

    Hi, I've attempted to test your provided best caffemodel in the validation set. Following the results you reported in SSL, the overall acc., mean acc. and mIoU should be 84.36%, 54.94%, 44.73%, respectively, but I used the provided code and only got the 82.06%, 51.64%, 40.95%. Besides, I've also tried other methods (deeplab_v2 , attention without ssl ) according to your training strategies and all of them get the lower results. Are there any changes to the validation set ? Thx !

    opened by LinaShanghaitech 0
Owner
Clay Gong
Computer Vision
Clay Gong
BMW TechOffice MUNICH 148 Dec 21, 2022
Video Autoencoder: self-supervised disentanglement of 3D structure and motion

Video Autoencoder: self-supervised disentanglement of 3D structure and motion This repository contains the code (in PyTorch) for the model introduced

null 157 Dec 22, 2022
Unified Pre-training for Self-Supervised Learning and Supervised Learning for ASR

UniSpeech The family of UniSpeech: UniSpeech (ICML 2021): Unified Pre-training for Self-Supervised Learning and Supervised Learning for ASR UniSpeech-

Microsoft 282 Jan 9, 2023
A Game-Theoretic Perspective on Risk-Sensitive Reinforcement Learning

Officile code repository for "A Game-Theoretic Perspective on Risk-Sensitive Reinforcement Learning"

Mathieu Godbout 1 Nov 19, 2021
TSP: Temporally-Sensitive Pretraining of Video Encoders for Localization Tasks

TSP: Temporally-Sensitive Pretraining of Video Encoders for Localization Tasks [Paper] [Project Website] This repository holds the source code, pretra

Humam Alwassel 83 Dec 21, 2022
Location-Sensitive Visual Recognition with Cross-IOU Loss

The trained models are temporarily unavailable, but you can train the code using reasonable computational resource. Location-Sensitive Visual Recognit

Kaiwen Duan 146 Dec 25, 2022
Deep RGB-D Saliency Detection with Depth-Sensitive Attention and Automatic Multi-Modal Fusion (CVPR'2021, Oral)

DSA^2 F: Deep RGB-D Saliency Detection with Depth-Sensitive Attention and Automatic Multi-Modal Fusion (CVPR'2021, Oral) This repo is the official imp

如今我已剑指天涯 46 Dec 21, 2022
Pull sensitive data from users on windows including discord tokens and chrome data.

⭐ For a ?? Pegasus Pull sensitive data from users on windows including discord tokens and chrome data. Features ?? Discord tokens ?? Geolocation data

Addi 44 Dec 31, 2022
This repository contains the code for "Self-Diagnosis and Self-Debiasing: A Proposal for Reducing Corpus-Based Bias in NLP".

Self-Diagnosis and Self-Debiasing This repository contains the source code for Self-Diagnosis and Self-Debiasing: A Proposal for Reducing Corpus-Based

Timo Schick 62 Dec 12, 2022
Implementation of "Semi-supervised Domain Adaptive Structure Learning"

Semi-supervised Domain Adaptive Structure Learning - ASDA This repo contains the source code and dataset for our ASDA paper. Illustration of the propo

null 3 Dec 13, 2021
[CVPR 2021] "The Lottery Tickets Hypothesis for Supervised and Self-supervised Pre-training in Computer Vision Models" Tianlong Chen, Jonathan Frankle, Shiyu Chang, Sijia Liu, Yang Zhang, Michael Carbin, Zhangyang Wang

The Lottery Tickets Hypothesis for Supervised and Self-supervised Pre-training in Computer Vision Models Codes for this paper The Lottery Tickets Hypo

VITA 59 Dec 28, 2022
Patch Rotation: A Self-Supervised Auxiliary Task for Robustness and Accuracy of Supervised Models

Patch-Rotation(PatchRot) Patch Rotation: A Self-Supervised Auxiliary Task for Robustness and Accuracy of Supervised Models Submitted to Neurips2021 To

null 4 Jul 12, 2021
This repository is related to an Arabic tutorial, within the tutorial we discuss the common data structure and algorithms and their worst and best case for each, then implement the code using Python.

Data Structure and Algorithms with Python This repository is related to the Arabic tutorial here, within the tutorial we discuss the common data struc

Mohamed Ayman 33 Dec 2, 2022
Repository providing a wide range of self-supervised pretrained models for computer vision tasks.

Hierarchical Pretraining: Research Repository This is a research repository for reproducing the results from the project "Self-supervised pretraining

Colorado Reed 53 Nov 9, 2022
This repository is the official implementation of Unleashing the Power of Contrastive Self-Supervised Visual Models via Contrast-Regularized Fine-Tuning (NeurIPS21).

Core-tuning This repository is the official implementation of ``Unleashing the Power of Contrastive Self-Supervised Visual Models via Contrast-Regular

vanint 18 Dec 17, 2022
Official repository for the paper "Self-Supervised Models are Continual Learners" (CVPR 2022)

Self-Supervised Models are Continual Learners This is the official repository for the paper: Self-Supervised Models are Continual Learners Enrico Fini

Enrico Fini 73 Dec 18, 2022
[CVPR2021] The source code for our paper 《Removing the Background by Adding the Background: Towards Background Robust Self-supervised Video Representation Learning》.

TBE The source code for our paper "Removing the Background by Adding the Background: Towards Background Robust Self-supervised Video Representation Le

Jinpeng Wang 150 Dec 28, 2022
PyTorch code for Vision Transformers training with the Self-Supervised learning method DINO

Self-Supervised Vision Transformers with DINO PyTorch implementation and pretrained models for DINO. For details, see Emerging Properties in Self-Supe

Facebook Research 4.2k Jan 3, 2023
Official code for "Mean Shift for Self-Supervised Learning"

MSF Official code for "Mean Shift for Self-Supervised Learning" Requirements Python >= 3.7.6 PyTorch >= 1.4 torchvision >= 0.5.0 faiss-gpu >= 1.6.1 In

UMBC Vision 44 Nov 21, 2022