From 86f446d7bdbe2208fb0066cd7f90f103d7714874 Mon Sep 17 00:00:00 2001 From: "chris.ochoa" Date: Tue, 11 Jun 2024 05:32:17 +0000 Subject: [PATCH] lint fix --- tests/test_camera_transforms.py | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/tests/test_camera_transforms.py b/tests/test_camera_transforms.py index 2b49047..650c828 100644 --- a/tests/test_camera_transforms.py +++ b/tests/test_camera_transforms.py @@ -1,11 +1,12 @@ # Copyright 2021-2022 Woven Planet. All rights reserved. import os -from typing import OrderedDict import unittest +from typing import OrderedDict -import cv2 import numpy as np +import PIL +import cv2 from dgp.annotations.camera_transforms import ( AffineCameraTransform, CompositeAffineTransform, @@ -19,11 +20,10 @@ from dgp.annotations.ontology import KeyLineOntology, KeyPointOntology from dgp.datasets.synchronized_dataset import SynchronizedSceneDataset from dgp.proto.ontology_pb2 import Ontology as OntologyV2Pb2 +from dgp.utils.pose import Pose from dgp.utils.structures.key_line_2d import KeyLine2D from dgp.utils.structures.key_point_2d import KeyPoint2D from dgp.utils.visualization_utils import visualize_cameras -from dgp.utils.pose import Pose -import PIL from tests import TEST_DATA_DIR # Flag to render test images @@ -430,7 +430,7 @@ def test_crop_scale_transform(self): valid_region = (dw, dh, w - dw, h - dh) assert_almost_equal(cam_datum, cam_datum3, valid_region=valid_region) - + def test_crop_scale_transform_simple(self): """Simple test case for crop scale transform""" @@ -439,18 +439,19 @@ def test_crop_scale_transform_simple(self): 'datum_type': 'image', 'pose': Pose(), 'extrinsics': Pose(), - 'intrinsics': np.array([[1976.45, 0, 2692/2], - [0, 1977.05, 1836/2], - [0,0,1.0],]), + 'intrinsics': np.array([ + [1976.45, 0, 2692 / 2], + [0, 1977.05, 1836 / 2], + [0, 0, 1.0], + ]), 'rgb': PIL.Image.new('RGB', (2692, 1836)), }) - target_shape = (544,960) + target_shape = (544, 960) tr = CropScaleTransform(target_shape=target_shape, fix_h=False) datum2 = tr(datum) - assert np.isclose( datum2['intrinsics'][0,0], 704.82, atol=1e-3) - assert np.isclose( datum2['intrinsics'][1,1], 705.04, atol=1e-3) - + assert np.isclose(datum2['intrinsics'][0, 0], 704.82, atol=1e-3) + assert np.isclose(datum2['intrinsics'][1, 1], 705.04, atol=1e-3) def test_composite_transform(self): """Test that we can compose transforms correctly. We test that we can get the