25 lines
616 B
Python
25 lines
616 B
Python
import h5py, os
|
|
from floder.config import cfg
|
|
|
|
def writef(uuid, num_id, feature):
|
|
fname = os.sep.join([cfg.hFile, uuid+'.h5'])
|
|
if not os.path.exists(fname):
|
|
f = h5py.File(fname, 'w')
|
|
f[str(num_id)] = feature
|
|
else:
|
|
f = h5py.File(fname, 'a')
|
|
f[str(num_id)] = feature
|
|
print('>>>>>>>have been write')
|
|
f.close()
|
|
|
|
def readf(uuid, num_id):
|
|
fname = os.sep.join([cfg.hFile, uuid+'.h5'])
|
|
f = h5py.File(fname, 'r')
|
|
value = f[str(num_id)][:]
|
|
f.close()
|
|
return value
|
|
|
|
def removef(uuid):
|
|
fname = os.sep.join([cfg.hFile, uuid+'.h5'])
|
|
os.remove(fname)
|