测试voc2007Annotations没有显示结果
zqdeepbluesky opened this issue · 5 comments
Hi,非常感谢你的代码。你之前的回答对我很有帮助,不过当我想在voc2007annotations上测试时却没有结果输出,我不知道那地方出错了,你能帮帮我吗?如下是我的结果:
dxt@dxt-System-Product-Name:~/kmeans-anchor-boxes-master$ python3 -m unittest discover -s tests/
..............
Ran 14 tests in 77.215s
OK
最后只出现了这个结果,我直接将annotations放在了kmeans-anchor-boxes-master文件夹下,只需要annotations吗,是否还需要其他的文件,你能指出哪些地方可能会出问题吗?非常感谢你,祝你生活愉快。
Hi, you did it correctly. You just have to print the output, for example add to test_kmeans_5(self) in test_voc2007.py the line print(out). And then you can do what I wrote you previously. I'll give you an example:
from kmeans import *
import numpy as np
data = np.array([[10,50],[10,60],[20,20]])
out = kmeans(data, k=2)
print("Result", avg_iou(data, out))
print("Boxes", out)
You only have to replace "data" with your data.
hi,你好吗,非常感谢你的帮助,现在我得到了结果,我的结果如下:
dxt@dxt-System-Product-Name:~/kmeans-anchor-boxes-master$ python3 -m unittest discover -s tests/
............Result 0.001034816
Boxes
[[ 0.172 0.124]
[ 0.294 0.396]
[ 0.736 0.684]
[ 0.07 0.072]
[ 0.11 0.288]]
.Result 0.00131874577778
Boxes
[[ 0.262 0.582]
[ 0.058 0.06 ]
[ 0.19 0.148]
[ 0.14 0.372]
[ 0.808 0.794]
[ 0.532 0.422]
[ 0.32 0.25 ]
[ 0.076 0.204]
[ 0.116 0.09 ]]
.
Ran 14 tests in 49.104s
OK
我有点疑惑,为什么我的result结果这么低呢?它对我的聚类结果会有影响吗?
还有个疑问,请原谅我比较菜。。。
如你说的“You only have to replace "data" with your data.”
是设置 “data = np.array([[10,50],[10,60],[20,20]])”这个吗?
这个应该根据数据的哪个方面来设置?你能告诉我吗?非常感谢啦。祝你工作顺利。
The accuracy you get is really too low. You get 0.13% accuracy, but at least 50% is normal. I think you didn't set up the data correctly. Check the annotations (xml files). I uploaded an example. The data array should be set up like it was done in load_dataset(). The array should only be different if you don't use the same format as VOC2007. Just use example.py and you should be fine.
hi,非常感谢你的耐心回答,现在我得到了正确的anchors聚类结果。
再次感谢你,祝你生活愉快。
,
你是怎么得到结果的呢?
我的会报错
asus@asus:~/c001/VOC2007/kmeans-anchor-boxes-master$ python3 -m unittest discover -s tests/
............FF
FAIL: test_kmeans_5 (test_voc2007.TestVoc2007)
Traceback (most recent call last):
File "/home/luvision/c001/VOC2007/kmeans-anchor-boxes-master/tests/test_voc2007.py", line 37, in test_kmeans_5
np.testing.assert_almost_equal(percentage, 0.61, decimal=2)
File "/home/luvision/anaconda3/lib/python3.6/site-packages/numpy/testing/nose_tools/utils.py", line 581, in assert_almost_equal
raise AssertionError(_build_err_msg())
AssertionError:
Arrays are not almost equal to 2 decimals
ACTUAL: 0.8394690411933133
DESIRED: 0.61
======================================================================
FAIL: test_kmeans_9 (test_voc2007.TestVoc2007)
Traceback (most recent call last):
File "/home/luvision/c001/VOC2007/kmeans-anchor-boxes-master/tests/test_voc2007.py", line 45, in test_kmeans_9
np.testing.assert_almost_equal(percentage, 0.672, decimal=2)
File "/home/luvision/anaconda3/lib/python3.6/site-packages/numpy/testing/nose_tools/utils.py", line 581, in assert_almost_equal
raise AssertionError(_build_err_msg())
AssertionError:
Arrays are not almost equal to 2 decimals
ACTUAL: 0.8947800941384673
DESIRED: 0.672
Ran 14 tests in 5.298s
FAILED (failures=2)
如果去掉下面两行:
np.testing.assert_almost_equal(percentage, 0.61, decimal=2)
np.testing.assert_almost_equal(percentage, 0.672, decimal=2)
就是这样
asus@asus:~/c001/VOC2007/kmeans-anchor-boxes-master$ python3 -m unittest discover -s tests/
..............
Ran 14 tests in 3.390s
OK