This page includes some resource of our paper “Deep Relative Distance Learning: Tell the Difference Between Similar Vehicles”.

Since we are not allowed to release the complete code due to some confidential protocols, we provide only the core part and the model’s prototxt files(for both training and testing) here.

  • You can find the source code of “coupled clusters loss”, “triplet loss”, “l2 normalization” and all other related caffe code here. Notice that you can not feed multiple labels to a normal data layer in the original Caffe. Thus, we modified “MemoryDataLayer” to support it. For instance, if you want to feed 3 different labels(label1, label2, label3) into the MemoryDataLayer, please edit your data layer in the prototxt like.

layer {
	name: "data"
	type: "MemoryData"
	top: "data"
	top: "label1"
	top: "label2"
	top: "label3"
	include {
		phase: TRAIN
	memory_data_param {
		num_tasks: 3
		batch_size: 128
		channels: 3
		height: 224
		width: 224

You can then feed the input data in Python like

x = np.zeros((128, 3, 224, 224), dtype=np.float32)
y = np.zeros((3, 128), dtype=np.float32)
solver.net.set_input_arrays(X, Y)
  • We also release our model’s prototxt files for both training and testing. You can download it here.
  • The VehicleID dataset can be find here.