{"action":"created","issue":{"url":"https://api.github.com/repos/BVLC/caffe/issues/3225","labels_url":"https://api.github.com/repos/BVLC/caffe/issues/3225/labels{/name}","comments_url":"https://api.github.com/repos/BVLC/caffe/issues/3225/comments","events_url":"https://api.github.com/repos/BVLC/caffe/issues/3225/events","html_url":"https://github.com/BVLC/caffe/issues/3225","id":112397753,"number":3225,"title":"Caffe python interface cannot read encoded image from LMDB.","user":{"login":"erogol","id":1402048,"avatar_url":"https://avatars.githubusercontent.com/u/1402048?v=3","gravatar_id":"","url":"https://api.github.com/users/erogol","html_url":"https://github.com/erogol","followers_url":"https://api.github.com/users/erogol/followers","following_url":"https://api.github.com/users/erogol/following{/other_user}","gists_url":"https://api.github.com/users/erogol/gists{/gist_id}","starred_url":"https://api.github.com/users/erogol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/erogol/subscriptions","organizations_url":"https://api.github.com/users/erogol/orgs","repos_url":"https://api.github.com/users/erogol/repos","events_url":"https://api.github.com/users/erogol/events{/privacy}","received_events_url":"https://api.github.com/users/erogol/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-10-20T15:40:25Z","updated_at":"2015-11-06T17:32:08Z","closed_at":null,"body":"Following code, which I assume it is true, does not work if the the images in LMDB are encoded.\r\n```\r\nimport caffe\r\nimport lmdb\r\nimport numpy as np\r\nfrom caffe.proto import caffe_pb2\r\n\r\nlmdb_env = lmdb.open('/matrix/users/eglge/Libs/caffe_bundle/caffe/data/imagenet/')\r\nlmdb_txn = lmdb_env.begin()\r\nlmdb_cursor = lmdb_txn.cursor()\r\ndatum = caffe_pb2.Datum()\r\n\r\nfor key, value in lmdb_cursor:\r\n    datum.ParseFromString(value)\r\n\r\n    label = datum.label\r\n    data = caffe.io.datum_to_array(datum)\r\n```\r\nI got the label value but all other fields in datum returns 0 like channel, height and width."},"comment":{"url":"https://api.github.com/repos/BVLC/caffe/issues/comments/154479973","html_url":"https://github.com/BVLC/caffe/issues/3225#issuecomment-154479973","issue_url":"https://api.github.com/repos/BVLC/caffe/issues/3225","id":154479973,"user":{"login":"galloguille","id":5067468,"avatar_url":"https://avatars.githubusercontent.com/u/5067468?v=3","gravatar_id":"","url":"https://api.github.com/users/galloguille","html_url":"https://github.com/galloguille","followers_url":"https://api.github.com/users/galloguille/followers","following_url":"https://api.github.com/users/galloguille/following{/other_user}","gists_url":"https://api.github.com/users/galloguille/gists{/gist_id}","starred_url":"https://api.github.com/users/galloguille/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/galloguille/subscriptions","organizations_url":"https://api.github.com/users/galloguille/orgs","repos_url":"https://api.github.com/users/galloguille/repos","events_url":"https://api.github.com/users/galloguille/events{/privacy}","received_events_url":"https://api.github.com/users/galloguille/received_events","type":"User","site_admin":false},"created_at":"2015-11-06T17:32:08Z","updated_at":"2015-11-06T17:32:08Z","body":"Yes, thank you for pointing that out, to get the image as BGR\r\n```image_bgr = img[...,::-1]```\r\nwill do the trick."}}