MCPcopy Create free account
hub / github.com/JasonLSC/GSCodec_Studio / main

Function main

examples/image_fitting.py:161–185  ·  view source on GitHub ↗
(
    height: int = 256,
    width: int = 256,
    num_points: int = 100000,
    save_imgs: bool = True,
    img_path: Optional[Path] = None,
    iterations: int = 1000,
    lr: float = 0.01,
    model_type: Literal["3dgs", "2dgs"] = "3dgs",
)

Source from the content-addressed store, hash-verified

159
160
161def main(
162 height: int = 256,
163 width: int = 256,
164 num_points: int = 100000,
165 save_imgs: bool = True,
166 img_path: Optional[Path] = None,
167 iterations: int = 1000,
168 lr: float = 0.01,
169 model_type: Literal["3dgs", "2dgs"] = "3dgs",
170) -> None:
171 if img_path:
172 gt_image = image_path_to_tensor(img_path)
173 else:
174 gt_image = torch.ones((height, width, 3)) * 1.0
175 # make top left and bottom right red, blue
176 gt_image[: height // 2, : width // 2, :] = torch.tensor([1.0, 0.0, 0.0])
177 gt_image[height // 2 :, width // 2 :, :] = torch.tensor([0.0, 0.0, 1.0])
178
179 trainer = SimpleTrainer(gt_image=gt_image, num_points=num_points)
180 trainer.train(
181 iterations=iterations,
182 lr=lr,
183 save_imgs=save_imgs,
184 model_type=model_type,
185 )
186
187
188if __name__ == "__main__":

Callers

nothing calls this directly

Calls 3

trainMethod · 0.95
image_path_to_tensorFunction · 0.85
SimpleTrainerClass · 0.85

Tested by

no test coverage detected