Spaces:
Running
on
L40S
Running
on
L40S
File size: 415 Bytes
d69879c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
import cv2
import os
import os.path as osp
from pathlib import Path
import pickle
def get_object(name):
objects_dir = osp.join(Path(__file__).parent.absolute(), 'objects')
if not name.endswith('.pkl'):
name = name+".pkl"
filepath = osp.join(objects_dir, name)
if not osp.exists(filepath):
return None
with open(filepath, 'rb') as f:
obj = pickle.load(f)
return obj
|