Giter VIP home page Giter VIP logo

mmd-caffe's Introduction

DEPRECATED

This repository is deprecated, please move to transfer-caffe

mmd-caffe

This is the implementation of PAMI paper "Learning Transferable Visual Features with Very Deep Adaptation Networks". We fork the repository with version ID c6414ea from Caffe and make our modifications. The main modifications are listed as follow:

  • Change the label from a single integer to a tuple, which contains the origin label and an indicator to distinguish source and target
  • Add mmd layer described in the paper to neuron layers
  • Add entropy loss layer described in the paper to loss layers

Training Model

In models/google_net/amazon_to_webcam, we give an example model based on GoogLeNet. In this model, we insert mmd layers after inception 4d, 4e, 5a and the last fully connect layer individually. In addition, an entropy loss layer is linked after the last fully connect layer.

The bvlc_googlenet is used as the pre-trained model.

Data Preparation

In data/office/amazon_to_webcam/*.txt, we give an example to show how to prepare the train and test data file. In this task, amazon dataset is the source domain and webcam dataset is the target domain. For training data in source domain, it's label looks like (-1, origin_label). For training data in target domain, it's label looks like (origin_label, -1). For testing data, it's label looks like (origin_label, -1). Integer -1 is used to distinguish source and target during training and testing, and origin_label is the acutal label of the image.

For semi-supervised tasks, the label of labeled target data looks like (I, origin_label). I is any positive integer (larger than the number of classes) and should be added to ignore_label of entropy loss layer.

Parameter Tuning

In models/google_net/amazon_to_webcam/proto_parse.py, we write a python script to help tune the network parameters. An inception is ragarded as a unit and it's parameters are tuned together.

Besides, parameter iter_of_epoch should be set to tell mmd layer when to update data. Practically, iter_of_epoch = (source_num + target_num) / batch_size.

Dependency

We use CGAL to solve Quadratic Programming problem when updating beta. Please install it before compiling this code. We add CGAL as LIBRARIES in Makefile. However, if you prefer to compile caffe with cmake, maybe you should config CGAL yourself.

mmd-caffe's People

Contributors

zhuhan1236 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

mmd-caffe's Issues

single-step debug

When I uncomment the code DEBUG=1 in file "Makefile.config", there is no problem compiling. However, it returns an error when runing, saying:
Expr:-CGAL_IA_MUL(-1.1,10.1)!=CGAL_IA_MUL(1.1,10.1)
Explanation:Wrong rounding: did you forget the -frounding-math option if you use GCC (or -f-model strict for Intel)
I cannot find a solution and can you give me some advices? Thank you.

Loss is NAN...

Hi,
When i am running you code for amazon to webcam I getting the fc7MMD and fc8 MMD loss value equal to NAN.. Could you please where I am wrong???

Run time error

I have successfully complied the project. But run time error appears when I start training with the command:
build/tools/caffe.bin train -solver models/icml/amazon_to_webcam_common_setting/solver.prototxt -weights models/bvlc_reference_caffenet.caffemodel -gpu 0

I0915 14:21:56.463819 27231 mmd_layer.cu:69] before mmd diff 5.76657
I0915 14:21:56.468710 27231 mmd_layer.cu:107] bandwidth 3.65977e-05
I0915 14:21:56.476428 27231 mmd_layer.cu:464] after mmd diff sum 7.71586
I0915 14:21:56.476439 27231 mmd_layer.cu:465] ------
I0915 14:21:56.486502 27231 solver.cpp:189] Iteration 8, loss = 2.62049
I0915 14:21:56.486516 27231 solver.cpp:465] Iteration 8, lr = 0.001
F0915 14:21:56.619989 27231 math_functions.cu:125] Check failed: status == CUBLAS_STATUS_SUCCESS (11 vs. 0) CUBLAS_STATUS_MAPPING_ERROR
*** Check failure stack trace: ***
@ 0x7f95c82e25cd google::LogMessage::Fail()
@ 0x7f95c82e4433 google::LogMessage::SendToLog()
@ 0x7f95c82e215b google::LogMessage::Flush()
@ 0x7f95c82e4e1e google::LogMessageFatal::~LogMessageFatal()
@ 0x7f95c87579de caffe::caffe_gpu_asum<>()
@ 0x7f95c8792329 caffe::SoftmaxWithLossLayer<>::Forward_gpu()
@ 0x7f95c8742712 caffe::Net<>::ForwardFromTo()
@ 0x7f95c8742907 caffe::Net<>::ForwardPrefilled()
@ 0x7f95c8731042 caffe::Solver<>::Step()
@ 0x7f95c8731b64 caffe::Solver<>::Solve()
@ 0x407e99 train()
@ 0x405be8 main
@ 0x7f95c7775830 __libc_start_main
@ 0x406109 _start
@ (nil) (unknown)
Aborted (core dumped)

Aborted at 1478502296 (unix time) try "date -d @1478502296" if you are using GNU date ***

Hi,zhuhan.When I added your implemention of MMD to the lastest caffe version,I met the following error:
*** Aborted at 1478502296 (unix time) try "date -d @1478502296" if you are using GNU date *** PC: @ 0x7f645ee615a6 caffe::Blob<>::Reshape() *** SIGSEGV (@0x0) received by PID 21540 (TID 0x7f645f8b9a40) from PID 0; stack trace: *** @ 0x7f645d7d5cb0 (unknown) @ 0x7f645ee615a6 caffe::Blob<>::Reshape() @ 0x7f645edf645a caffe::Net<>::ForwardFromTo() @ 0x7f645edf67f7 caffe::Net<>::Forward() @ 0x7f645ee52807 caffe::Solver<>::Step() @ 0x7f645ee530c9 caffe::Solver<>::Solve() @ 0x4094ab train() @ 0x4068ac main @ 0x7f645d7c0f45 (unknown) @ 0x40711b (unknown) @ 0x0 (unknown) Segmentation fault (core dumped)
It works well before the program run if(now_iter_>=iter_of_epoch) ,..,blablabla command.
Could you tell me what happens?
Thanks in advance.

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.