We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 1199c5a + 7327792 commit d4ea5c7Copy full SHA for d4ea5c7
timm/data/parsers/class_map.py
@@ -1,5 +1,5 @@
1
import os
2
-
+import pickle
3
4
def load_class_map(map_or_filename, root=''):
5
if isinstance(map_or_filename, dict):
@@ -13,6 +13,9 @@ def load_class_map(map_or_filename, root=''):
13
if class_map_ext == '.txt':
14
with open(class_map_path) as f:
15
class_to_idx = {v.strip(): k for k, v in enumerate(f)}
16
+ elif class_map_ext == '.pkl':
17
+ with open(class_map_path,'rb') as f:
18
+ class_to_idx = pickle.load(f)
19
else:
20
assert False, f'Unsupported class map file extension ({class_map_ext}).'
21
return class_to_idx
0 commit comments