summaryrefslogtreecommitdiff
path: root/old/faiss/util.py
diff options
context:
space:
mode:
authorjules@lens <julescarbon@gmail.com>2019-02-13 02:02:11 +0100
committerjules@lens <julescarbon@gmail.com>2019-02-13 02:02:11 +0100
commit857a8a5f13fa63e7cbc56bfee0361c8c02860424 (patch)
treecaf41529595dd05ca0808a9fcf5739613df3438c /old/faiss/util.py
parent84500c8a1e4e7ef267d71fdf8ad5a52fb33b2cb5 (diff)
parentdc7d9cbba842472efb33186e97ee55751e4d50ca (diff)
Merge branch 'master' of asdf.us:megapixels_dev
Diffstat (limited to 'old/faiss/util.py')
-rw-r--r--old/faiss/util.py29
1 files changed, 0 insertions, 29 deletions
diff --git a/old/faiss/util.py b/old/faiss/util.py
deleted file mode 100644
index 97afbc22..00000000
--- a/old/faiss/util.py
+++ /dev/null
@@ -1,29 +0,0 @@
-import time
-import simplejson as json
-import pickle
-from os import path
-from collections import namedtuple
-
-# Converts JSON el['key'] to Pythonic object-style el.key
-def _json_object_hook(d):
- return namedtuple('X', d.keys())(*d.values())
-
-# Load a JSON recipe
-def load_recipe(path):
- with open(path) as fh:
- return json.load(fh, object_hook=_json_object_hook)
-
-# Load a pickle file
-def load_pickle(data_dir, pkl_fn):
- load_start = time.time()
- with open(path.join(str(data_dir), str(pkl_fn)), 'rb') as fh:
- raw = fh.read()
- data = pickle.loads(raw)
- load_end = time.time()
- load_time = load_end - load_start
- print("Pickle load time: {:.1f}s".format(load_time))
- return data
-
-def read_json(fn):
- with open(fn, 'r') as json_file:
- return json.load(json_file)