Open zhizhz opened 1 year ago
I guess this is related to the version of ot. OT has recently released a major update that enables multiple backends (e.g. torch and numpy). Your error message tells that it was a 'backend' problem.
You can try to reverse to an older version of ot without multi-backend support.
谢谢老师解答,我尝试了
def Emd_metric(l_pred, l_gt, size=(400, 400)): points1 = get_points_coords(l_pred) points2 = get_points_coords(l_gt)
points1 = np.array(points1)
points2 = np.array(points2)
#points1 = torch.cuda.FloatTensor(points1)
#points2 = torch.cuda.FloatTensor(points2)
M = ot.dist(points1, points2, metric='euclidean')
_, log = ot.emd([], [], M, log=True)
cost = log['cost']
return 1 - cost / np.sqrt(size[0] * size[0] + size[1] * size[1])
这样可以在不更改ot版本情况下,解决我上述问题,但是运行python testsel.py文件的时候不会报错但运行时间很长,在训练的时候显示信息如下: Training Loss:0.004758382216095924: 100%|█████| 1300/1300 [08:46<00:00, 2.47it/s] 1%|▎ | 10/1300 [13:04<23:48:51, 66.46s/it] 在验证过程中耗费时间太多,请问老师这是正常的吗,还是说这还是与ot版本有关,需要将ot版本转回旧版本,方便问一下老师您当时POT版本是多少吗
谢谢老师解答,我尝试了
def Emd_metric(l_pred, l_gt, size=(400, 400)): points1 = get_points_coords(l_pred) points2 = get_points_coords(l_gt)
points1 = np.array(points1) points2 = np.array(points2) #points1 = torch.cuda.FloatTensor(points1) #points2 = torch.cuda.FloatTensor(points2) M = ot.dist(points1, points2, metric='euclidean') _, log = ot.emd([], [], M, log=True) cost = log['cost'] return 1 - cost / np.sqrt(size[0] * size[0] + size[1] * size[1])
这样可以在不更改ot版本情况下,解决我上述问题,但是运行python testsel.py文件的时候不会报错但运行时间很长,在训练的时候显示信息如下: Training Loss:0.004758382216095924: 100%|█████| 1300/1300 [08:46<00:00, 2.47it/s] 1%|▎ | 10/1300 [13:04<23:48:51, 66.46s/it] 在验证过程中耗费时间太多,请问老师这是正常的吗,还是说这还是与ot版本有关,需要将ot版本转回旧版本,方便问一下老师您当时POT版本是多少吗
Any thoughts on this?
老师您好,在我测试您的代码的时候根据readme更换评价指标的时候,是否只需要更改hungarian_matching.py的判断语句: for i in range(prediction_len): for j in range(gt_len):
if EA_metric(p_lines[i], g_lines[j]) >= threshold:
在我进行不同评价指标测试的时候发现Emd_metric的评价指标的时候会不出结果,而在Chamfer _metric的评价指标的时候会有如下报错: Traceback (most recent call last): File "/home/qiao/app/pycharm-community-2022.2.2/plugins/python-ce/helpers/pydev/pydevd.py", line 1496, in _exec pydev_imports.execfile(file, globals, locals) # execute the script File "/home/qiao/app/pycharm-community-2022.2.2/plugins/python-ce/helpers/pydev/_pydev_imps/_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "/home/qiao/Desktop/deep-hough-transform-master/metric.py", line 83, in
emd_score = Emd_metric(l1, l2)
File "/home/qiao/Desktop/deep-hough-transform-master/metric.py", line 50, in Emd_metric
M = ot.dist(points1, points2, metric='euclidean')
File "/home/qiao/anaconda3/lib/python3.7/site-packages/ot/utils.py", line 219, in dist
return euclidean_distances(x1, x2, squared=False)
File "/home/qiao/anaconda3/lib/python3.7/site-packages/ot/utils.py", line 165, in euclidean_distances
nx = get_backend(X, Y)
File "/home/qiao/anaconda3/lib/python3.7/site-packages/ot/backend.py", line 82, in get_backend
raise ValueError("Unknown type of non implemented backend.")
ValueError: Unknown type of non implemented backend.
python-BaseException
请问老师,是我更改评价标准的程序步骤没有完全吗还是这个ot.dist函数的原因?