deepdetect icon indicating copy to clipboard operation
deepdetect copied to clipboard

db:true on service results in Data layer prefetch queue empty

Open whelanp opened this issue 9 years ago • 6 comments

Hello

I am seeing some strange behaviour I would like sanity checked.

I can create a service and train off data with the following configs.

Service { "mllib":"caffe", "description":"prediction service", "type":"supervised", "parameters":{ "input":{ "connector":"csv" }, "mllib":{ "template":"mlp", "nclasses":2, "layers":[150,150,150], "activation":"prelu" } }, "model":{ "templates":"../templates/caffe/", "repository":"/data" } } and then for training { "service":"pdw", "async":true, "parameters":{ "mllib":{ "gpu":false, "solver":{ "iterations":10000, "test_interval":100, "base_lr":0.05 }, "net":{ "batch_size": 5120 } }, "input":{ "label":"LATER_RS", "separator":",", "shuffle":true, "test_split":0.1, "scale":true }, "output":{ "measure":["acc","mcll","f1"] } }, "data":["/data/training.csv"] } this works well and I am getting an precision figure I am happy with. However when I increase the training data samples (large csv > 1 million records) I include the db true parameters in my configs as per the documentation.

Dataset does not fit into memory ? Use mlp or convnet as neural network template and db:true in mllib parameter in /service creation call and again input parameter in /train call: this tells the neural network to take its data from a db and the connector to build this db as needed.

However when I do this my logs show the following.

INFO - 16:24:44 - Data layer prefetch queue empty INFO - 16:24:44 - Data layer prefetch queue empty INFO - 16:24:44 - Data layer prefetch queue empty INFO - 16:24:44 - Data layer prefetch queue empty INFO - 16:24:44 - Data layer prefetch queue empty INFO - 16:24:44 - Data layer prefetch queue empty INFO - 16:24:44 - Data layer prefetch queue empty INFO - 16:24:44 - Data layer prefetch queue empty INFO - 16:24:44 - Data layer prefetch queue empty INFO - 16:24:44 - Data layer prefetch queue empty INFO - 16:24:44 - Data layer prefetch queue empty INFO - 16:24:44 - Data layer prefetch queue empty INFO - 16:24:44 - Iteration 1400, lr = 0.05 INFO - 16:24:44 - Ignoring source layer prob INFO - 16:24:44 - Opened lmdb /data/test.lmdb[16:24:44] /opt/deepdetect/src/caffelib.cc:717: batch size=512 [16:24:44] /opt/deepdetect/src/caffelib.cc:723: train_loss=0.20076 [16:24:44] /opt/deepdetect/src/caffelib.cc:723: mcll=-nan [16:24:44] /opt/deepdetect/src/caffelib.cc:723: accp=-nan [16:24:44] /opt/deepdetect/src/caffelib.cc:723: acc=-nan [16:24:44] /opt/deepdetect/src/caffelib.cc:723: f1=-nan [16:24:44] /opt/deepdetect/src/caffelib.cc:723: recall=0 [16:24:44] /opt/deepdetect/src/caffelib.cc:723: iteration=1400 [16:24:44] /opt/deepdetect/src/caffelib.cc:723: precision=0 [16:24:44] /opt/deepdetect/src/caffelib.cc:783: smoothed_loss=0.228789

This pattern is repeated as you can see I have precision of 0.

The only difference to parameters is the db:true in both configuration files for the service and training.

Am I missing something here?

Thanks Paul

whelanp avatar Apr 24 '17 16:04 whelanp

Hi, first try lowering the learning rate to 0.01 and 0.001, and let me know what happens. There's a difference of transformation capabilities inside Caffe within in-memory input and db layers that may be the culprit here. If nothing changes, please include all prototxt files and full server logs.

beniz avatar Apr 24 '17 16:04 beniz

Thanks for the speedy reply.

I've tried lowering the learning rate first to 0.01 and then 0.001 to no avail. Please find the requested prototxt files and logs.

deploy.prototxt.txt mlp.prototxt.txt mlp_solver.prototxt.txt dd.log.txt

Paul

PS: This is running using the docker image in case its relevant.

whelanp avatar Apr 24 '17 17:04 whelanp

From your dd.log.txt:

INFO - 17:13:28 - CSV db test file /data/test.lmdb with 0 records[17:13:29] /opt/deepdetect/src/caffelib.cc:1627: user batch_size=512 / inputc batch_size=45445

Your test.lmdb (test set) is empty, thus the nan metric. If you are letting DD shuffle and split your dataset, it is likely you have mistakenly set or omitted a tsplit. Let me know if you can't where things got wrong.

beniz avatar Apr 24 '17 17:04 beniz

Thanks Beniz

When you say

it is likely you have mistakenly set or omitted a tsplit

Do you mean the "test_split":0.1 in the training request? I've tried removing the shuffle and and test_split parameters in the training call to no avail.

Paul

whelanp avatar Apr 25 '17 09:04 whelanp

Not exactly. And actually, my bad, here is the trick: using db:true with CSV, DD assumes you are doing so because your CSV would not hold into memory. Thus it assumes you would not let DD shuffle your CSV nor split it into memory.

For this reason, using db:true with CSV input connector, DD asssumes you are submitting a pre-split CSV. The way to do this is to set your data parameter array as something like:

"data":["/path/to/train.csv","/path/to/test.csv"]

We should add it to the FAQ as it may be confusing to many users. Let me know how this goes first.

beniz avatar Apr 25 '17 09:04 beniz

Thanks Beniz :)

I used the linux commands head and tail to split the CSV file as suggested. And updated the data parameter with the filenames.

With this I can see that my precision is indeed back looking decent.

Thanks so much for such a great product and even greater support!

this is the train request body that worked for me { "service":"pdw", "async":true, "parameters":{ "mllib":{ "gpu":false, "solver":{ "iterations":10000, "test_interval":100, "base_lr":0.001 }, "net":{ "batch_size": 512 } }, "input":{ "label":"LATER_RS", "separator":",", "db": true, "scale":true }, "output":{ "measure":["acc","mcll","f1"] } }, "data":["/data/train.csv", "/data/test.csv"] }

whelanp avatar Apr 25 '17 11:04 whelanp