yahoo / CaffeOnSpark

Distributed deep learning on Hadoop and Spark clusters.
Apache License 2.0
1.27k stars 358 forks source link

How to understand the source code FloatBlob and FloatArray?Trying to modify the source code for R-FCN. #269

Closed Zzmc closed 7 years ago

Zzmc commented 7 years ago

hello everyone, I'm trying to modify the source code,i want to make the CaffeOnSpark run R-FCN. i have done most source code ,but i don't know how to change the soure code FloatBlob and FloatArray.i don't know what the role of FloatBlob and FloatArray.Should i creat new Blobs suit my labels(it's not a simple label,it's a Array, there is a lot of data).if not ,what should i do? And how to understand the role of FloatBlob and FloatArray?

junshi15 commented 7 years ago

You don't need to touch FloatBlob and FloatArray.

DataFrame source supports array labels. You probably should use CoS layer on the caffe side. data source, CoS layer, and an example.

Zzmc commented 7 years ago

@junshi15 thanks for you answer, i have saw the CoSlayer ,but i still have some questions.my labels is not for basic classification(it's not 0 or 1),it is a new data type(DetectGroupLabel,creat by myself),for example, { "date": [ { "group_lable": 2, "Annotation": [ { "id": 0, "bbox": { "Xmin": 0.16145833, "Ymin": 0.28796297, "Xmax": 0.22916667, "Ymax": 0.39907408, "label": 0, "diffcult": false, "score": 0, "size": 0 } }, { "id": 1, "bbox": { "Xmin": 0.3359375, "Ymin": 0.24166666, "Xmax": 0.4484375, "Ymax": 0.31111112, "label": 0, "diffcult": false, "score": 0, "size": 0 } } ] }, { "group_lable": 5, "Annotation": [ { "id": 0, "bbox": { "Xmin": 0.63489586, "Ymin": 0.19537038, "Xmax": 0.659375, "Ymax": 0.23703703, "label": 0, "diffcult": false, "score": 0, "size": 0 } }, { "id": 1, "bbox": { "Xmin": 0.44895834, "Ymin": 0.21203704, "Xmax": 0.47291666, "Ymax": 0.26944444, "label": 0, "diffcult": false, "score": 0, "size": 0 } } ] } ] } and the CoSlayer is not suit for my require, i need do complex data transform,so i creat my own layer for R-FCN, but when i send the data to FloatBlob an FloatArray, it's not suit my data type,FloatBlob and FloatArray just only suit Float data type ,but my data type is DetectGroupLabel(it's created in Caffe.proto: "repeated DetectGroupLabel detection_group = 3;"),so what shold i do now? Is my idea wrong ?

junshi15 commented 7 years ago

Spark data frame does not accept protobuf messages. If you can change your label to float array, then you may be able to use CoS layer.

In your example above, if you can convert your data to the following, then maybe you can use CoS layer, but you will have to modify CoS layer to parse the array to its original fields, for example, the first 2 is group label, the next 0 is id, then Xmin, etc. 2, 0, 0.16145833, 0.28796297, 0.22916667, 0.39907408, 0, 0, 0, 0, 1, 0.3359375, 0.24166666, 0.4484375, 0.31111112, 0, 0, 0, 0,...

Zzmc commented 7 years ago

@junshi15 Thanks for your suggestion,i will try it.