2 minute read

Coarse Mesh Extraction (coarse_mesh.py)์™€ Refined Mesh Extraction (refined_mesh.py)์˜ ์ฐจ์ด์ 

๋‘ ์Šคํฌ๋ฆฝํŠธ๋Š” Gaussian Splatting ๊ธฐ๋ฐ˜์˜ 3D ์žฌ๊ตฌ์„ฑ ์‹œ์Šคํ…œ์—์„œ ๋ฉ”์‹œ๋ฅผ ์ถ”์ถœํ•˜๋Š” ๋ฐ ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค. ๊ทธ๋Ÿฌ๋‚˜ ๊ฐ ์Šคํฌ๋ฆฝํŠธ๋Š” ๋‹ค๋ฅด๊ฒŒ ์ ‘๊ทผํ•˜๋ฉฐ, ๊ฐ๊ฐ์˜ ๋ชฉ์ ๊ณผ ์„ธ๋ถ€ ์ž‘์—…์ด ๋‹ค๋ฆ…๋‹ˆ๋‹ค. ์•„๋ž˜์—์„œ ์ฃผ์š” ์ฐจ์ด์ ๊ณผ ํ•ต์‹ฌ ์š”์†Œ๋ฅผ ์„ค๋ช…ํ•ฉ๋‹ˆ๋‹ค.

์ฃผ์š” ์ฐจ์ด์ 

  1. ๋ชจ๋ธ์˜ ๋‹จ๊ณ„:
    • Coarse Mesh Extraction (coarse_mesh.py): ์ด ์Šคํฌ๋ฆฝํŠธ๋Š” ์ดˆ๊ธฐ ๋ชจ๋ธ(Coarse Model)์„ ์‚ฌ์šฉํ•˜์—ฌ ๊ธฐ๋ณธ์ ์ธ 3D ๋ฉ”์‹œ๋ฅผ ์ถ”์ถœํ•ฉ๋‹ˆ๋‹ค. ์ฃผ๋กœ ์ €ํ•ด์ƒ๋„์˜ ์ดˆ๊ธฐ ์žฌ๊ตฌ์„ฑ์„ ์œ„ํ•ด ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค.
    • Refined Mesh Extraction (refined_mesh.py): ์ด ์Šคํฌ๋ฆฝํŠธ๋Š” ์ •์ œ๋œ ๋ชจ๋ธ(Refined Model)์„ ์‚ฌ์šฉํ•˜์—ฌ ๊ณ ํ•ด์ƒ๋„์˜ ์„ธ๋ฐ€ํ•œ 3D ๋ฉ”์‹œ์™€ ํ…์Šค์ฒ˜๋ฅผ ์ถ”์ถœํ•ฉ๋‹ˆ๋‹ค. ์ฃผ๋กœ ์ตœ์ข…์ ์ธ ์„ธ๋ฐ€ํ•œ ์žฌ๊ตฌ์„ฑ์„ ์œ„ํ•ด ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค.
  2. ํ…์Šค์ฒ˜ ์ฒ˜๋ฆฌ:
    • Coarse Mesh Extraction: ํ…์Šค์ฒ˜์— ๋Œ€ํ•œ ์ฒ˜๋ฆฌ๋ฅผ ๋ช…์‹œ์ ์œผ๋กœ ๋‹ค๋ฃจ์ง€ ์•Š์Šต๋‹ˆ๋‹ค.
    • Refined Mesh Extraction: ํ…์Šค์ฒ˜๋ฅผ ์ถ”์ถœํ•˜๊ณ  ์ด๋ฅผ ๋ฉ”์‹œ์— ์ ์šฉํ•ฉ๋‹ˆ๋‹ค. ํ…์Šค์ฒ˜ ๋งต๊ณผ UV ๋งต์„ ์ƒ์„ฑํ•˜์—ฌ ๋ณด๋‹ค ํ˜„์‹ค๊ฐ ์žˆ๋Š” 3D ๋ชจ๋ธ์„ ๋งŒ๋“ญ๋‹ˆ๋‹ค.
  3. ํ›„์ฒ˜๋ฆฌ ๊ณผ์ •:
    • Coarse Mesh Extraction: ๋ฉ”์‹œ๋ฅผ ์ถ”์ถœํ•œ ํ›„, ์ €ํ•ด์ƒ๋„์˜ ๋ฉ”์‹œ์— ๋Œ€ํ•ด ๋‹ค์–‘ํ•œ ์ •๋ฆฌ ์ž‘์—…(์˜ˆ: ์ €๋ฐ€๋„ ๋ฒ„ํ…์Šค ์ œ๊ฑฐ, ๋ฉ”์‹œ ์ •๋ฆฌ)์„ ์ˆ˜ํ–‰ํ•ฉ๋‹ˆ๋‹ค.
    • Refined Mesh Extraction: ๋ฉ”์‹œ์˜ ํ›„์ฒ˜๋ฆฌ๋ฅผ ํ†ตํ•ด ๊ฒฝ๊ณ„๋ฉด์˜ ์ €๋ฐ€๋„ ๊ฐ€์šฐ์‹œ์•ˆ์„ ์ œ๊ฑฐํ•˜๊ณ  ๋ฉ”์‹œ๋ฅผ ๋” ๊น”๋”ํ•˜๊ฒŒ ๋งŒ๋“ญ๋‹ˆ๋‹ค.

ํ•ต์‹ฌ ์š”์†Œ ์š”์•ฝ

coarse_mesh.py

  1. ๋ชจ๋ธ ๋ฐ ๋ฐ์ดํ„ฐ ๋กœ๋“œ:
    • Gaussian Splatting Wrapper์™€ ์ดˆ๊ธฐ Coarse Model์„ ๋กœ๋“œํ•ฉ๋‹ˆ๋‹ค.
  2. ๊ฐ€์šฐ์‹œ์•ˆ ํ•„ํ„ฐ๋ง ๋ฐ ๋ฉ”์‹œ ์ƒ์„ฑ:
    • ์ €ํ•ด์ƒ๋„์˜ ๊ฐ€์šฐ์‹œ์•ˆ ํฌ์ธํŠธ ํด๋ผ์šฐ๋“œ์—์„œ ์‚ผ๊ฐํ˜• ๋ฉ”์‹œ๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.
    • ์ €๋ฐ€๋„ ๊ฐ€์šฐ์‹œ์•ˆ์„ ์ œ๊ฑฐํ•˜์—ฌ ๋ฉ”์‹œ๋ฅผ ์ •๋ฆฌํ•ฉ๋‹ˆ๋‹ค.
  3. ๋ฉ”์‹œ ์ •๋ฆฌ ๋ฐ ์ €์žฅ:
    • Poisson surface reconstruction์„ ํ†ตํ•ด ํฌ์ธํŠธ ํด๋ผ์šฐ๋“œ๋กœ๋ถ€ํ„ฐ ์‚ผ๊ฐํ˜• ๋ฉ”์‹œ๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.
    • ๋ฉ”์‹œ๋ฅผ ์ •๋ฆฌํ•˜๊ณ , ๋””์‹œ๋ฉ”์ด์…˜(decimation)์„ ํ†ตํ•ด ๊ฐ„์†Œํ™”ํ•œ ํ›„ ์ €์žฅํ•ฉ๋‹ˆ๋‹ค.

refined_mesh.py

  1. ๋ชจ๋ธ ๋ฐ ๋ฐ์ดํ„ฐ ๋กœ๋“œ:
    • refined model์„ ๋กœ๋“œํ•ฉ๋‹ˆ๋‹ค.
    • ์ด์ „์— ์ถ”์ถœ๋œ Coarse Mesh๋ฅผ ๋กœ๋“œํ•ฉ๋‹ˆ๋‹ค.
  2. ํ…์Šค์ฒ˜ ์ถ”์ถœ:
    • refined model์—์„œ ํ…์Šค์ฒ˜์™€ UV ๋งต์„ ์ถ”์ถœํ•ฉ๋‹ˆ๋‹ค.
    • ํ…์Šค์ฒ˜ ์ด๋ฏธ์ง€๋ฅผ ์ƒ์„ฑํ•˜๊ณ  ์ด๋ฅผ ๋ฉ”์‹œ์— ์ ์šฉํ•ฉ๋‹ˆ๋‹ค.
  3. ๋ฉ”์‹œ ํ›„์ฒ˜๋ฆฌ ๋ฐ ์ €์žฅ:
    • ๊ฒฝ๊ณ„๋ฉด์˜ ์ €๋ฐ€๋„ ๊ฐ€์šฐ์‹œ์•ˆ์„ ์ œ๊ฑฐํ•˜์—ฌ ๋ฉ”์‹œ๋ฅผ ์ •๋ฆฌํ•ฉ๋‹ˆ๋‹ค.
    • ํ…์Šค์ฒ˜๊ฐ€ ์ ์šฉ๋œ ๋ฉ”์‹œ๋ฅผ ์ €์žฅํ•ฉ๋‹ˆ๋‹ค.

์ข…ํ•ฉ ๋น„๊ต

  • Coarse Mesh Extraction:
    • ๋ชฉํ‘œ: ์ดˆ๊ธฐ 3D ๋ฉ”์‹œ๋ฅผ ์ƒ์„ฑํ•˜๊ณ , ์ €๋ฐ€๋„ ๊ฐ€์šฐ์‹œ์•ˆ์„ ์ œ๊ฑฐํ•˜์—ฌ ์ •๋ฆฌ๋œ ์ €ํ•ด์ƒ๋„ ๋ฉ”์‹œ๋ฅผ ์–ป๋Š” ๊ฒƒ.
    • ํŠน์ง•: ํฌ์ธํŠธ ํด๋ผ์šฐ๋“œ์™€ Poisson Surface Reconstruction์„ ์‚ฌ์šฉ.
  • Refined Mesh Extraction:
    • ๋ชฉํ‘œ: ๊ณ ํ•ด์ƒ๋„์˜ ์„ธ๋ฐ€ํ•œ 3D ๋ฉ”์‹œ์™€ ํ…์Šค์ฒ˜๋ฅผ ์ถ”์ถœํ•˜์—ฌ ์ตœ์ข… ๋ชจ๋ธ์„ ์ƒ์„ฑํ•˜๋Š” ๊ฒƒ.
    • ํŠน์ง•: ํ…์Šค์ฒ˜ ๋งต๊ณผ UV ๋งต์„ ์ƒ์„ฑํ•˜์—ฌ ๋ณด๋‹ค ํ˜„์‹ค๊ฐ ์žˆ๋Š” ๋ชจ๋ธ์„ ๊ตฌ์„ฑ.

์ด ๋‘ ์Šคํฌ๋ฆฝํŠธ๋Š” 3D ๋ชจ๋ธ๋ง์˜ ์„œ๋กœ ๋‹ค๋ฅธ ๋‹จ๊ณ„์—์„œ ์‚ฌ์šฉ๋˜๋ฉฐ, ๊ฐ๊ฐ์˜ ์Šคํฌ๋ฆฝํŠธ๋Š” ํ•ด๋‹น ๋‹จ๊ณ„์˜ ๋ชฉํ‘œ์— ๋งž์ถ”์–ด ์ตœ์ ํ™”๋˜์–ด ์žˆ์Šต๋‹ˆ๋‹ค. coarse_mesh.py๋Š” ์ดˆ๊ธฐ ์žฌ๊ตฌ์„ฑ ๋‹จ๊ณ„์—์„œ ์‚ฌ์šฉ๋˜๊ณ , refined_mesh.py๋Š” ์ตœ์ข… ๋‹จ๊ณ„์˜ ์„ธ๋ฐ€ํ•œ ์žฌ๊ตฌ์„ฑ ๋ฐ ํ…์Šค์ฒ˜๋ง์— ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค.


์ฝ”๋“œ ๋ถ„์„

๊ธฐ๋ณธ logging ํˆด (CONSOLE)

CONSOLE์€ rich ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ์—์„œ ์ œ๊ณตํ•˜๋Š” Console ๊ฐ์ฒด๋กœ, ํ„ฐ๋ฏธ๋„์—์„œ ๋” ๋‚˜์€ ์ถœ๋ ฅ์„ ์ œ๊ณตํ•˜๊ธฐ ์œ„ํ•ด ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค. rich ๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋Š” ํ„ฐ๋ฏธ๋„์—์„œ ์ปฌ๋Ÿฌ ํ…์ŠคํŠธ, ํ‘œ, ํŠธ๋ฆฌ, ๋กœ๊น… ๋“ฑ์„ ์‰ฝ๊ฒŒ ์ถœ๋ ฅํ•  ์ˆ˜ ์žˆ๋Š” ๊ธฐ๋Šฅ์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค.

  • CONSOLE ๊ฐ์ฒด๋Š” ์Šคํฌ๋ฆฝํŠธ ์‹คํ–‰ ์ค‘ ์ฃผ์š” ์ •๋ณด๋ฅผ ์ฝ˜์†”์— ์ถœ๋ ฅํ•˜๊ณ , ํ…์ŠคํŠธ๋ฅผ ์ปฌ๋Ÿฌ๋กœ ์ถœ๋ ฅํ•˜๊ฑฐ๋‚˜ ํŠน์ • ๋„ˆ๋น„๋ฅผ ๊ฐ€์ง€๋Š” ํ˜•์‹์œผ๋กœ ์ถœ๋ ฅํ•  ์ˆ˜ ์žˆ๊ฒŒ ํ•ฉ๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด, Console(width=120)๋Š” ์ถœ๋ ฅ ๋„ˆ๋น„๋ฅผ 120 ๊ธ€์ž๋กœ ์„ค์ •ํ•˜์—ฌ ๊ฐ€๋…์„ฑ์„ ๋†’์ž…๋‹ˆ๋‹ค. ์ด๋ฅผ ํ†ตํ•ด ๋ชจ๋ธ ๋กœ๋“œ ์ƒํƒœ, ๋ฉ”์‹œ ์ƒ์„ฑ ์ƒํƒœ, ํ…์Šค์ฒ˜ ์ถ”์ถœ ์ƒํƒœ ๋“ฑ์„ ์‚ฌ์šฉ์ž์—๊ฒŒ ์•Œ๋ฆฝ๋‹ˆ๋‹ค.

    # coarse_sdf.py
    from rich.console import Console
      
    def coarse_training_with_sdf_regularization(args):
        CONSOLE = Console(width=120)
    
        ...
      
        CONSOLE.print("-----Parsed parameters-----")
        CONSOLE.print("Source path:", source_path)
        CONSOLE.print("   > Content:", len(os.listdir(source_path)))
        CONSOLE.print("Gaussian Splatting checkpoint path:", gs_checkpoint_path)
        CONSOLE.print("   > Content:", len(os.listdir(gs_checkpoint_path)))
        CONSOLE.print("SUGAR checkpoint path:", sugar_checkpoint_path)
        CONSOLE.print("Iteration to load:", iteration_to_load)
        CONSOLE.print("Output directory:", args.output_dir)
        CONSOLE.print("SDF estimation factor:", sdf_estimation_factor)
        CONSOLE.print("SDF better normal factor:", sdf_better_normal_factor)
        CONSOLE.print("Eval split:", use_eval_split)
        CONSOLE.print("White background:", use_white_background)
        CONSOLE.print("---------------------------")
    
        ...
    

    ์ถœ๋ ฅ ๊ฒฐ๊ณผ

    image

Leave a comment