-
Notifications
You must be signed in to change notification settings - Fork 59
/
Copy pathtest_read.py
32 lines (20 loc) · 830 Bytes
/
test_read.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import unittest
from grapher import ObjectTree
import pandas as pd
import cv2
df_path = './test_DONE - Samarth Metal Corporatrion 011-0/object_map.csv'
img_path = './test_DONE - Samarth Metal Corporatrion 011-0/detected_objects.jpg'
# validation dataframe
df_val = pd.read_csv(df_path)
df_val = df_val[['xmin', 'ymin', 'xmax', 'ymax', 'Object', 'label']]
img_val = cv2.imread(img_path, 0)
class ObjectTree_readTest(unittest.TestCase):
def test_empty(self):
# test dataframe
df = pd.read_csv(df_path)
img = cv2.imread(img_path, 0)
# test
c = ObjectTree(label_column='label')
c.read(df, img)
df, img = c.df, c.img
self.assertSequenceEqual(list(df.columns), list(df_val.columns))