mirror of
https://github.com/openmv/openmv.git
synced 2025-11-04 14:49:50 +08:00
Fix NN unittest.
This commit is contained in:
parent
42efbac090
commit
4d580033f2
BIN
scripts/unittest/data/cifar10_fast.network
Normal file
BIN
scripts/unittest/data/cifar10_fast.network
Normal file
Binary file not shown.
@ -5,11 +5,11 @@ def unittest(data_path, temp_path):
|
|||||||
files = os.listdir(test_dir)
|
files = os.listdir(test_dir)
|
||||||
total = len(files)
|
total = len(files)
|
||||||
labels = ['airplane', 'automobile', 'bird', 'cat', 'deer', 'dog', 'frog', 'horse', 'ship', 'truck']
|
labels = ['airplane', 'automobile', 'bird', 'cat', 'deer', 'dog', 'frog', 'horse', 'ship', 'truck']
|
||||||
net = nn.load('/cifar10_fast.network')
|
net = nn.load(data_path+'/cifar10_fast.network')
|
||||||
for f in sorted(files):
|
for f in sorted(files):
|
||||||
img = image.Image(test_dir+"/"+f, copy_to_fb=True)
|
img = image.Image(test_dir+"/"+f, copy_to_fb=True)
|
||||||
out = net.forward(img)
|
out = net.forward(img)
|
||||||
label = labels[out.index(max(out))]
|
label = labels[out.index(max(out))]
|
||||||
if (f.split('-')[0] == label):
|
if (f.split('-')[0] == label):
|
||||||
match += 1
|
match += 1
|
||||||
return (total == 21 and match == 19)
|
return ((match / total * 100 ) > 90)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user