replaced floatn() with round()
This commit is contained in:
parent
8a1f35eac6
commit
a278623067
4
test.py
4
test.py
|
@ -127,8 +127,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[5])],
|
'category_id': coco91class[int(d[5])],
|
||||||
'bbox': [floatn(x, 3) for x in box[di]],
|
'bbox': [round(x, 3) for x in box[di]],
|
||||||
'score': floatn(d[4], 5)})
|
'score': round(d[4], 5)})
|
||||||
|
|
||||||
# Assign all predictions as incorrect
|
# Assign all predictions as incorrect
|
||||||
correct = torch.zeros(pred.shape[0], niou, dtype=torch.bool, device=device)
|
correct = torch.zeros(pred.shape[0], niou, dtype=torch.bool, device=device)
|
||||||
|
|
|
@ -26,10 +26,6 @@ np.set_printoptions(linewidth=320, formatter={'float_kind': '{:11.5g}'.format})
|
||||||
cv2.setNumThreads(0)
|
cv2.setNumThreads(0)
|
||||||
|
|
||||||
|
|
||||||
def floatn(x, n=3): # format floats to n decimals
|
|
||||||
return float(format(x, '.%gf' % n))
|
|
||||||
|
|
||||||
|
|
||||||
def init_seeds(seed=0):
|
def init_seeds(seed=0):
|
||||||
random.seed(seed)
|
random.seed(seed)
|
||||||
np.random.seed(seed)
|
np.random.seed(seed)
|
||||||
|
|
Loading…
Reference in New Issue