Exemple #1
0
 def test_one_car(self):
     cars_a, people_a, tensor = self.initialize()
     expected = tensor.copy()
     expected[1, 1, 1, 5] = 0.1
     cars_a[0].append((1, 1, 1, 1, 1, 1))
     out, cars_predicted, people_predicted, reconstruction_2D = frame_reconstruction(
         tensor, cars_a, people_a)
     np.testing.assert_array_equal(out, expected)
Exemple #2
0
    def test_one_person(self):
        cars_a, people_a, tensor = self.initialize()
        expected = tensor.copy()
        expected[1, 1, 1, 4] = 0.1

        people_a[0].append(np.ones((3, 2), dtype=np.int))
        out, cars_predicted, people_predicted, reconstruction_2D = frame_reconstruction(
            tensor, cars_a, people_a)
        np.testing.assert_array_equal(out, expected)
Exemple #3
0
 def test_many_cars(self):
     cars_a, people_a, tensor = self.initialize()
     expected = tensor.copy()
     indx = 0
     for x in range(0, 3):
         for y in range(0, 3):
             cars_a[indx].append((0, 0, x, x, y, y))
             indx += 1
     expected[0, :, :, 5] = 0.1 * np.ones(expected.shape[1:3])
     out, cars_predicted, people_predicted, reconstruction_2D = frame_reconstruction(
         tensor, cars_a, people_a)
     np.testing.assert_array_equal(out, expected)
Exemple #4
0
 def test_two_cars(self):
     cars_a, people_a, tensor = self.initialize()
     expected = tensor.copy()
     cars_a[0].append((0, 0, 0, 0, 0, 0))
     cars_a[0].append((0, 0, 0, 0, 2, 2))
     cars_a[2].append((0, 0, 0, 0, 0, 1))
     expected[0, 0, 0, 5] = 0.2
     expected[0, 0, 1, 5] = 0.1
     expected[0, 0, 2, 5] = 0.1
     out, cars_predicted, people_predicted, reconstruction_2D = frame_reconstruction(
         tensor, cars_a, people_a)
     np.testing.assert_array_equal(out, expected)
Exemple #5
0
 def test_many_people(self):
     cars_a, people_a, tensor = self.initialize()
     expected = tensor.copy()
     indx = 0
     #vals=[[0,1],[0,2],[1,3],[2,3]]
     for x in range(0, 3):
         for y in range(0, 3):
             people_a[indx].append(
                 np.array([[0, 0], [y, y], [x, x]], np.int32))
             indx += 1
     expected[0, :, :, 4] = 0.1 * np.ones(expected.shape[1:3])
     out, cars_predicted, people_predicted, reconstruction_2D = frame_reconstruction(
         tensor, cars_a, people_a)
     np.testing.assert_array_equal(out, expected)
Exemple #6
0
 def test_empty(self):
     cars_a, people_a, tensor = self.initialize()
     out, cars_predicted, people_predicted, reconstruction_2D = frame_reconstruction(
         tensor, cars_a, people_a)
     np.testing.assert_array_equal(out, tensor)