Skip to content

Commit

Permalink
[fix] Fix LMDBFeatureReader (#116)
Browse files Browse the repository at this point in the history
Summary:
Fix LMDBFeatureReader

Test Plan : Test with mmimdb dataset.
Pull Request resolved: fairinternal/mmf-internal#116

Reviewed By: apsdehal

Differential Revision: D21445705

Pulled By: vedanuj

fbshipit-source-id: af96f3cc32f50d3c97ebc2df8ca815f97bea0c0d
  • Loading branch information
vedanuj authored and facebook-github-bot committed May 7, 2020
1 parent de51763 commit 6c3c670
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions mmf/datasets/databases/readers/feature_readers.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,16 +202,14 @@ def _load(self, image_file_path):
image_id = int(split.split("_")[-1])
# Try fetching to see if it actually exists otherwise fall back to
# default
_ = self.image_id_indices[image_id]
img_id_idx = self.image_id_indices[str(image_id).encode()]
except (ValueError, KeyError):
# The image id is complex or involves folder, use it directly
image_id = split
image_id = str(image_id).encode()
image_id = str(split).encode()
img_id_idx = self.image_id_indices[image_id]

with self.env.begin(write=False, buffers=True) as txn:
image_info = pickle.loads(
txn.get(self.image_ids[self.image_id_indices[image_id]])
)
image_info = pickle.loads(txn.get(self.image_ids[img_id_idx]))

return image_info

Expand Down

0 comments on commit 6c3c670

Please sign in to comment.