Skip to content

Commit 7623457

Browse files
classnerfacebook-github-bot
authored andcommitted
Removing LOGGER.debug statements for performance gain. (#1260)
Summary: We identified that these logging statements can deteriorate performance in certain cases. I propose removing them from the regular renderer implementation and letting individuals re-insert debug logging wherever needed on a case-by-case basis. Pull Request resolved: #1260 Reviewed By: kjchalup Differential Revision: D38737439 Pulled By: bottler fbshipit-source-id: cf9dcbbeae4dbf214c2e17d5bafa00b2ff796393
1 parent d281f8e commit 7623457

File tree

1 file changed

+0
-42
lines changed

1 file changed

+0
-42
lines changed

pytorch3d/renderer/points/pulsar/renderer.py

-42
Original file line numberDiff line numberDiff line change
@@ -474,12 +474,6 @@ def _transform_cam_params(
474474
rot_mat = axis_angle_to_matrix(rot_vec)
475475
if first_R_then_T:
476476
pos_vec = torch.matmul(rot_mat, pos_vec[..., None])[:, :, 0]
477-
LOGGER.debug(
478-
"Camera position: %s, rotation: %s. Focal length: %s.",
479-
str(pos_vec),
480-
str(rot_vec),
481-
str(focal_length),
482-
)
483477
sensor_dir_x = torch.matmul(
484478
rot_mat,
485479
torch.tensor(
@@ -500,56 +494,20 @@ def _transform_cam_params(
500494
)[:, :, 0]
501495
if right_handed:
502496
sensor_dir_z *= -1
503-
LOGGER.debug(
504-
"Sensor direction vectors: %s, %s, %s.",
505-
str(sensor_dir_x),
506-
str(sensor_dir_y),
507-
str(sensor_dir_z),
508-
)
509497
if orthogonal:
510498
sensor_center = pos_vec
511499
else:
512500
sensor_center = pos_vec + focal_length * sensor_dir_z
513-
LOGGER.debug("Sensor center: %s.", str(sensor_center))
514501
sensor_luc = ( # Sensor left upper corner.
515502
sensor_center
516503
- sensor_dir_x * (sensor_size_x / 2.0)
517504
- sensor_dir_y * (sensor_size_y / 2.0)
518505
)
519-
LOGGER.debug("Sensor luc: %s.", str(sensor_luc))
520506
pixel_size_x = sensor_size_x / float(width)
521507
pixel_size_y = sensor_size_y / float(height)
522-
LOGGER.debug(
523-
"Pixel sizes (x): %s, (y) %s.", str(pixel_size_x), str(pixel_size_y)
524-
)
525508
pixel_vec_x: torch.Tensor = sensor_dir_x * pixel_size_x
526509
pixel_vec_y: torch.Tensor = sensor_dir_y * pixel_size_y
527510
pixel_0_0_center = sensor_luc + 0.5 * pixel_vec_x + 0.5 * pixel_vec_y
528-
LOGGER.debug(
529-
"Pixel 0 centers: %s, vec x: %s, vec y: %s.",
530-
str(pixel_0_0_center),
531-
str(pixel_vec_x),
532-
str(pixel_vec_y),
533-
)
534-
if not orthogonal:
535-
LOGGER.debug(
536-
"Camera horizontal fovs: %s deg.",
537-
str(
538-
2.0
539-
* torch.atan(0.5 * sensor_size_x / focal_length)
540-
/ math.pi
541-
* 180.0
542-
),
543-
)
544-
LOGGER.debug(
545-
"Camera vertical fovs: %s deg.",
546-
str(
547-
2.0
548-
* torch.atan(0.5 * sensor_size_y / focal_length)
549-
/ math.pi
550-
* 180.0
551-
),
552-
)
553511
# Reduce dimension.
554512
focal_length: torch.Tensor = focal_length[:, 0]
555513
if batch_processing:

0 commit comments

Comments
 (0)