This commit is contained in:
Glenn Jocher 2019-07-20 17:14:07 +02:00
parent 3512f7ff61
commit f991f2f4d5
2 changed files with 4 additions and 4 deletions

View File

@ -102,8 +102,8 @@ def test(cfg,
for di, d in enumerate(pred): for di, d in enumerate(pred):
jdict.append({'image_id': image_id, jdict.append({'image_id': image_id,
'category_id': coco91class[int(d[6])], 'category_id': coco91class[int(d[6])],
'bbox': [float3(x) for x in box[di]], 'bbox': [floatn(x, 3) for x in box[di]],
'score': float(format('.5f', d[4]))}) 'score': floatn(d[4], 5)})
# Clip boxes to image bounds # Clip boxes to image bounds
clip_coords(pred, (height, width)) clip_coords(pred, (height, width))

View File

@ -23,8 +23,8 @@ np.set_printoptions(linewidth=320, formatter={'float_kind': '{:11.5g}'.format})
cv2.setNumThreads(0) cv2.setNumThreads(0)
def float3(x): # format floats to 3 decimals def floatn(x, n=3): # format floats to n decimals
return float(format(x, '.3f')) return float(format(x, '.%gf' % n))
def init_seeds(seed=0): def init_seeds(seed=0):