@@ -31,68 +31,68 @@ def tearDownClass(cls):
3131 rmtree ('integration-cl-split' )
3232 rmtree ('integration-cl-img-f' )
3333
34- # def test_cli(self):
35- # """Verify data.npz produced by CLI"""
36- # cmd = 'label-maker package --dest integration-cl --config test/fixtures/integration/config.integration.json'
37- # cmd = cmd.split(' ')
38- # subprocess.run(cmd, universal_newlines=True)
39- #
40- # data = np.load('integration-cl/data.npz')
41- # # validate our image data with sums and shapes
42- # self.assertEqual(np.sum(data['x_train']), 144752757)
43- # self.assertEqual(np.sum(data['x_test']), 52758414)
44- # self.assertEqual(data['x_train'].shape, (6, 256, 256, 3))
45- # self.assertEqual(data['x_test'].shape, (2, 256, 256, 3))
46- #
47- # # validate our label data with exact matches
48- # expected_y_train = np.array(
49- # [[0, 0, 0, 0, 0, 0, 1],
50- # [0, 0, 0, 0, 0, 0, 1],
51- # [0, 0, 0, 0, 0, 0, 1],
52- # [0, 1, 1, 0, 0, 0, 1],
53- # [0, 0, 0, 0, 1, 1, 1],
54- # [0, 0, 0, 0, 0, 0, 1]]
55- # )
56- # self.assertTrue(np.array_equal(data['y_train'], expected_y_train))
57- #
58- # expected_y_test = np.array(
59- # [[0, 0, 0, 0, 0, 0, 1],
60- # [0, 0, 0, 0, 0, 0, 1]]
61- # )
62- # self.assertTrue(np.array_equal(data['y_test'], expected_y_test))
63-
64- # def test_cli_3way_split(self):
65- # """Verify data.npz produced by CLI when split into train/test/val"""
66- #
67- # cmd = 'label-maker package --dest integration-cl-split --config test/fixtures/integration/config_3way.integration.json'
68- # cmd = cmd.split(' ')
69- # subprocess.run(cmd, universal_newlines=True)
70- #
71- # data = np.load('integration-cl-split/data.npz')
72- #
73- # # validate our image data with shapes
74- # self.assertEqual(data['x_train'].shape, (5, 256, 256, 3))
75- # self.assertEqual(data['x_test'].shape, (2, 256, 256, 3))
76- # self.assertEqual(data['x_val'].shape, (1, 256, 256, 3))
77- #
78- # # validate label data with shapes
79- # self.assertEqual(data['y_train'].shape, (5, 7))
80- # self.assertEqual(data['y_test'].shape, (2, 7))
81- # self.assertEqual(data['y_val'].shape, (1, 7))
82-
83- # def test_tms_img_format(self):
84- # """Verify data.npz produced by CLI"""
85- #
86- # cmd = 'label-maker package --dest integration-cl-img-f --config test/fixtures/integration/config_tms_format_img.json'
87- # cmd = cmd.split(' ')
88- # subprocess.run(cmd, universal_newlines=True)
89- #
90- # data = np.load('integration-cl-img-f/data.npz')
91- #
92- # # validate our image data with shapes
93- # self.assertEqual(data['x_train'].shape, (9, 256, 256, 3))
94- # self.assertEqual(data['x_test'].shape, (3, 256, 256, 3))
95- #
96- # # validate label data with shapes
97- # self.assertEqual(data['y_train'].shape, (9, 3))
98- # self.assertEqual(data['y_test'].shape, (3, 3))
34+ def test_cli (self ):
35+ """Verify data.npz produced by CLI"""
36+ cmd = 'label-maker package --dest integration-cl --config test/fixtures/integration/config.integration.json'
37+ cmd = cmd .split (' ' )
38+ subprocess .run (cmd , universal_newlines = True )
39+
40+ data = np .load ('integration-cl/data.npz' )
41+ # validate our image data with sums and shapes
42+ self .assertEqual (np .sum (data ['x_train' ]), 144752757 )
43+ self .assertEqual (np .sum (data ['x_test' ]), 52758414 )
44+ self .assertEqual (data ['x_train' ].shape , (6 , 256 , 256 , 3 ))
45+ self .assertEqual (data ['x_test' ].shape , (2 , 256 , 256 , 3 ))
46+
47+ # validate our label data with exact matches
48+ expected_y_train = np .array (
49+ [[0 , 0 , 0 , 0 , 0 , 0 , 1 ],
50+ [0 , 0 , 0 , 0 , 0 , 0 , 1 ],
51+ [0 , 0 , 0 , 0 , 0 , 0 , 1 ],
52+ [0 , 1 , 1 , 0 , 0 , 0 , 1 ],
53+ [0 , 0 , 0 , 0 , 1 , 1 , 1 ],
54+ [0 , 0 , 0 , 0 , 0 , 0 , 1 ]]
55+ )
56+ self .assertTrue (np .array_equal (data ['y_train' ], expected_y_train ))
57+
58+ expected_y_test = np .array (
59+ [[0 , 0 , 0 , 0 , 0 , 0 , 1 ],
60+ [0 , 0 , 0 , 0 , 0 , 0 , 1 ]]
61+ )
62+ self .assertTrue (np .array_equal (data ['y_test' ], expected_y_test ))
63+
64+ def test_cli_3way_split (self ):
65+ """Verify data.npz produced by CLI when split into train/test/val"""
66+
67+ cmd = 'label-maker package --dest integration-cl-split --config test/fixtures/integration/config_3way.integration.json'
68+ cmd = cmd .split (' ' )
69+ subprocess .run (cmd , universal_newlines = True )
70+
71+ data = np .load ('integration-cl-split/data.npz' )
72+
73+ # validate our image data with shapes
74+ self .assertEqual (data ['x_train' ].shape , (5 , 256 , 256 , 3 ))
75+ self .assertEqual (data ['x_test' ].shape , (2 , 256 , 256 , 3 ))
76+ self .assertEqual (data ['x_val' ].shape , (1 , 256 , 256 , 3 ))
77+
78+ # validate label data with shapes
79+ self .assertEqual (data ['y_train' ].shape , (5 , 7 ))
80+ self .assertEqual (data ['y_test' ].shape , (2 , 7 ))
81+ self .assertEqual (data ['y_val' ].shape , (1 , 7 ))
82+
83+ def test_tms_img_format (self ):
84+ """Verify data.npz produced by CLI"""
85+
86+ cmd = 'label-maker package --dest integration-cl-img-f --config test/fixtures/integration/config_tms_format_img.json'
87+ cmd = cmd .split (' ' )
88+ subprocess .run (cmd , universal_newlines = True )
89+
90+ data = np .load ('integration-cl-img-f/data.npz' )
91+
92+ # validate our image data with shapes
93+ self .assertEqual (data ['x_train' ].shape , (9 , 256 , 256 , 3 ))
94+ self .assertEqual (data ['x_test' ].shape , (3 , 256 , 256 , 3 ))
95+
96+ # validate label data with shapes
97+ self .assertEqual (data ['y_train' ].shape , (9 , 3 ))
98+ self .assertEqual (data ['y_test' ].shape , (3 , 3 ))
0 commit comments