1

from a script on preparing data for a caffe network, the following piece of code turns an image (numpy array representing an image) into a datum object.

datum = caffe_pb2.Datum(
        channels=3,
        width=224,
        height=224,
        label=label,
        data=np.rollaxis(img, 2).tostring())

If the network were unsupervised, do you just create the object the same way but do not fill the label parameter, as shown below?

datum = caffe_pb2.Datum(
            channels=3,
            width=224,
            height=224,
            data=np.rollaxis(img, 2).tostring())
Shai
  • 111,146
  • 38
  • 238
  • 371
Alejandro Simkievich
  • 3,512
  • 4
  • 33
  • 49

1 Answers1

1

The label of Datum is optional:

optional int32 label = 5;

Meaning oyu do not have to provide it.

Side note:
Datum is a data structure used mainly for "Data" input layer and strictly speaking it is not part of the trained net.
Caffe uses N-D tensors Blobs to store both data and parameters of the net.

Shai
  • 111,146
  • 38
  • 238
  • 371