Skip to content

Commit

Permalink
initial source release
Browse files Browse the repository at this point in the history
  • Loading branch information
Darius Rueckert committed Nov 2, 2021
1 parent 6a8c4bc commit 351d14e
Show file tree
Hide file tree
Showing 59 changed files with 11,069 additions and 3 deletions.
26 changes: 26 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Commented out parameters are those with the same value as base LLVM style
# We can uncomment them if we want to change their value, or enforce the
# chosen value in case the base style changes (last sync: Clang 6.0.1).
---
### General config, applies to all languages ###
BasedOnStyle: Google
IndentWidth: 4
BreakBeforeBraces: Allman
ColumnLimit: 120
DerivePointerAlignment: false
PointerAlignment: Left
MaxEmptyLinesToKeep: 3
SortIncludes: true
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^"(saiga)/'
Priority: 1
- Regex: '^"(internal)/'
Priority: 2
- Regex: '"[[:alnum:]./]+"'
Priority: 3
- Regex: '<[[:alnum:]./]+>'
Priority: 4
IndentPPDirectives: AfterHash
AlignConsecutiveAssignments: true
AllowShortFunctionsOnASingleLine: Inline
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
log/
valgrind*
cmake-build-*/
perf*
out.perf-folded
.idea/
checkpoints/
imgui.ini
build*/
debug/
config.ini
pretrained/
experiments/
86 changes: 86 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
cmake_minimum_required(VERSION 3.8 FATAL_ERROR)
project(ADOP VERSION 1.0.0 LANGUAGES CXX CUDA)

set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/External/saiga/cmake/")

include(helper_macros)
include(ExternalProject)
DefaultBuildType(RelWithDebInfo)
message("Build Options")

OptionsHelper(ADOP_HEADLESS "Skips the adop_viewer and other apps that require a window." OFF)
OptionsHelper(ADOP_ASAN "Adds sanitize=address compiler flag" OFF)

if (ADOP_HEADLESS)
set(SAIGA_MODULE_OPENGL OFF)
set(SAIGA_BUILD_GLFW OFF)
endif ()

############# Required LIBRARIES ###############

# Saiga
set(SAIGA_BUILD_SAMPLES OFF)
set(SAIGA_BUILD_TESTS OFF)
set(SAIGA_BUILD_SHARED ON)
set(SAIGA_MODULE_VISION OFF)
set(SAIGA_MODULE_VULKAN OFF)
#set(SAIGA_MODULE_CUDA OFF)
set(SAIGA_NO_INSTALL ON)
set(SAIGA_USE_SUBMODULES ON)
add_subdirectory(External/saiga)
PackageHelperTarget(saiga_core SAIGA_FOUND)
if (NOT ADOP_HEADLESS)
PackageHelperTarget(saiga_opengl SAIGA_FOUND)
endif ()
PackageHelperTarget(saiga_opengl SAIGA_FOUND)
PackageHelperTarget(saiga_cuda SAIGA_FOUND)

# Torch
find_package(Torch REQUIRED)
PackageHelperTarget(torch TORCH_FOUND)

# Torchvision
add_subdirectory(External/torchvision)
target_include_directories(torchvision PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/External/torchvision/>
$<INSTALL_INTERFACE:External/torchvision/>
)
PackageHelperTarget(torchvision TORCHVISION_FOUND)

############# COMPILER FLAGS ###############

if (MSVC)
#multiprocessor compilation for visual studio
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
else ()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror=return-type")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-strict-aliasing")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-sign-compare")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftemplate-backtrace-limit=0")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native -pthread")
endif ()


message(STATUS CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
message(STATUS CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS})

set(LIBS ${LIBS} ${LIB_TARGETS})

############# C++ Standard and Filesystem stuff ###############

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)



############# SOURCE ###############

add_subdirectory(src)







2 changes: 1 addition & 1 deletion External/saiga
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,27 @@ This will take between 12-24h depending on scene size and training hardware.
However, after 100 epochs (3-6h) the novel view synthesis already works very well.
You can use this checkpoint in the `adop_viewer` to check if everything is working.

## Camera Models

ADOP currently supports two different camera models.
The [Pinhole/Distortion](https://docs.opencv.org/4.5.4/d9/d0c/group__calib3d.html) camera model
and the [Omnidirectional](https://sites.google.com/site/scarabotix/ocamcalib-omnidirectional-camera-calibration-toolbox-for-matlab?authuser=0) camera model.

#### Pinhole/Distortion Camera Model

* The default model for photogrammetry software like COLMAP, Metashape and Capture Reality.
* Our implementation is found here: [Pinhole Part](https://github.com/darglein/saiga/blob/master/src/saiga/vision/cameraModel/Intrinsics4.h) and [Distortion Part](https://github.com/darglein/saiga/blob/master/src/saiga/vision/cameraModel/Distortion.h)

#### Omnidirectional Camera Model

* A fisheye camera model extreme wide-angle angles.
* Our implementation is found here: [Model](https://github.com/darglein/saiga/blob/master/src/saiga/vision/cameraModel/OCam.h)

#### Extending ADOP with other Camera Models

1. Implement the camera model and its derivative. The derivative should be returned as the Jacobian matrix.
2. Implement the forward and backward projection function [here](src/lib/rendering/PointRendererHelper.h).
3. Add a new type [here](src/lib/data/SceneData.h), update the [rasterization code](src/lib/rendering/PointRenderer.cu) and the [wrapper code](src/lib/data/NeuralStructure.h).

## Supplementary Material

Expand Down
31 changes: 31 additions & 0 deletions build_adop.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash

git submodule update --init --recursive --jobs 0
source $(conda info --base)/etc/profile.d/conda.sh
conda activate adop



if command -v g++-9 &> /dev/null
then
export CC=gcc-9
export CXX=g++-9
export CUDAHOSTCXX=g++-9
echo "Using g++-9"
elif command -v g++-7 &> /dev/null
then
export CC=gcc-7
export CXX=g++-7
export CUDAHOSTCXX=g++-7
echo "Using g++-7"
else
echo "No suitable compiler found. Install g++-7 or g++-9"
exit
fi


mkdir build
cd build
export CONDA=${CONDA_PREFIX:-"$(dirname $(which conda))/../"}
cmake -DCMAKE_PREFIX_PATH="${CONDA}/lib/python3.9/site-packages/torch/;${CONDA}" ..
make -j10
6 changes: 4 additions & 2 deletions create_environment.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
#!/bin/bash

git submodule update --init --recursive
git submodule update --init --recursive --jobs 0


source $(conda info --base)/etc/profile.d/conda.sh

#conda update -n base -c defaults conda

conda create -y -n adop python=3.9.7
conda activate adop

conda install -y cudnn=8.2.1.32 cudatoolkit-dev=11.2 cudatoolkit=11.2 -c nvidia -c conda-forge
conda install -y astunparse numpy ninja pyyaml mkl mkl-include setuptools cmake=3.19.6 cffi typing_extensions future six requests dataclasses
conda install -y astunparse numpy ninja pyyaml mkl mkl-include setuptools cmake=3.19.6 cffi typing_extensions future six requests dataclasses pybind11=2.6.2
conda install -y magma-cuda110 -c pytorch
Binary file added loss/traced_lpips.pt
Binary file not shown.
Binary file added loss/vgg_script_caffe.pth
Binary file not shown.
1 change: 1 addition & 0 deletions scenes/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*/
3 changes: 3 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
add_subdirectory(lib)
add_subdirectory(tests)
add_subdirectory(apps)
34 changes: 34 additions & 0 deletions src/apps/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
function(add_app TARGET_NAME)

set_target_properties(${TARGET_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin")
target_include_directories(${TARGET_NAME} PUBLIC ".")
target_link_libraries(${TARGET_NAME} NeuralPoints)

if (PR_NO_WINDOW)
target_compile_definitions(${TARGET_NAME} PUBLIC PR_NO_WINDOW)
endif ()


message(STATUS "App enabled: ${TARGET_NAME}")
endfunction()

add_executable(colmap2adop colmap2adop.cpp)
add_app(colmap2adop)

add_executable(preprocess_pointcloud preprocess_pointcloud.cpp)
add_app(preprocess_pointcloud)

add_executable(adop_train adop_train.cpp)
add_app(adop_train)

if (TARGET saiga_opengl)
add_executable(adop_viewer adop_viewer.cpp adop_viewer.h)
add_app(adop_viewer)


find_package(OpenVR QUIET)
if (${OPENVR_FOUND})
add_executable(adop_vr_viewer adop_vr_viewer.cpp)
add_app(adop_vr_viewer)
endif ()
endif ()
Loading

0 comments on commit 351d14e

Please sign in to comment.