first commit
This commit is contained in:
24
utils/opfile.py
Normal file
24
utils/opfile.py
Normal file
@ -0,0 +1,24 @@
|
||||
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)
|
Reference in New Issue
Block a user