Skip to content

Commit

Permalink
Linter fix: remove lambda and use numpy.rad2deg
Browse files Browse the repository at this point in the history
  • Loading branch information
oseiskar committed Apr 6, 2024
1 parent 1384df1 commit 730557a
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions nerfstudio/cameras/camera_optimizers.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
from __future__ import annotations

import functools
import math
from dataclasses import dataclass, field
from typing import Literal, Optional, Type, Union

import numpy
import torch
import tyro
from jaxtyping import Float, Int
Expand Down Expand Up @@ -182,11 +182,10 @@ def get_correction_matrices(self):
def get_metrics_dict(self, metrics_dict: dict) -> None:
"""Get camera optimizer metrics"""
if self.config.mode != "off":
rad2deg = lambda x: x / math.pi * 180.0
metrics_dict["camera_opt_translation_max"] = self.pose_adjustment[:, :3].norm(dim=-1).max()
metrics_dict["camera_opt_translation_mean"] = self.pose_adjustment[:, :3].norm(dim=-1).mean()
metrics_dict["camera_opt_rotation_mean"] = rad2deg(self.pose_adjustment[:, 3:].norm(dim=-1).mean())
metrics_dict["camera_opt_rotation_max"] = rad2deg(self.pose_adjustment[:, 3:].norm(dim=-1).max())
metrics_dict["camera_opt_rotation_mean"] = numpy.rad2deg(self.pose_adjustment[:, 3:].norm(dim=-1).mean())
metrics_dict["camera_opt_rotation_max"] = numpy.rad2deg(self.pose_adjustment[:, 3:].norm(dim=-1).max())

def get_param_groups(self, param_groups: dict) -> None:
"""Get camera optimizer parameters"""
Expand Down

0 comments on commit 730557a

Please sign in to comment.