-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP V3.*.* with torch-geometric RandLA-Net implementation (#39)
Development of PyG-RandLA-Net Co-authored-by: Michel Daab <[email protected]>
- Loading branch information
1 parent
8a731ad
commit 9aebf83
Showing
56 changed files
with
1,298 additions
and
506 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,57 +1,48 @@ | ||
FROM nvidia/cuda:10.2-devel-ubuntu18.04 | ||
# An nvidia image seems to be necessary for torch-points-kernel. | ||
# Also, a "devel" image seems required for the same library | ||
FROM nvidia/cuda:11.3.1-base-ubuntu20.04 | ||
|
||
# set the IGN proxy, otherwise apt-get and other applications don't work | ||
# Should be commented out outside of IGN | ||
ENV http_proxy 'http://192.168.4.9:3128/' | ||
ENV https_proxy 'http://192.168.4.9:3128/' | ||
|
||
# set the timezone, otherwise it asks for it... and freezes | ||
ENV TZ=Europe/Paris | ||
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone | ||
|
||
# Needed to use apt-get afterwards due to CUDA changes described here since April 27, 2022: | ||
# https://forums.developer.nvidia.com/t/notice-cuda-linux-repository-key-rotation/212772 | ||
# Not the recommpended method, but else we need wget installed afterwards. | ||
# We changed to 10.2-devel-ubuntu18.04 so that might not be needed. | ||
RUN apt-get update && apt-get upgrade -y && apt-get install -y wget | ||
RUN apt-key del 7fa2af80 | ||
RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub | ||
|
||
# all the apt-get installs | ||
RUN apt-get update && apt-get upgrade -y && apt-get install -y \ | ||
software-properties-common \ | ||
wget \ | ||
git \ | ||
libgl1-mesa-glx libegl1-mesa libxrandr2 libxrandr2 libxss1 libxcursor1 libxcomposite1 libasound2 libxi6 libxtst6 # package needed for anaconda | ||
|
||
RUN wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh \ | ||
&& /bin/bash ~/miniconda.sh -b -p /opt/conda \ | ||
&& rm ~/miniconda.sh | ||
|
||
ENV PATH /opt/conda/bin:$PATH | ||
|
||
# Only copy necessary files to set up the environment, | ||
# to use docker caching if requirements files were not updated. | ||
WORKDIR /setup_env | ||
COPY ./setup_env/ . | ||
|
||
# install mamba to setup the env faster | ||
RUN conda install -y mamba -n base -c conda-forge | ||
# Build the environment | ||
RUN mamba env create -f requirements.yml | ||
|
||
# Copy the repository content in /myria3d | ||
WORKDIR /myria3d | ||
# Remove any third-party apt sources to avoid issues with expiring keys. | ||
RUN rm -f /etc/apt/sources.list.d/*.list | ||
|
||
# Install some basic utilities | ||
RUN apt-get update && apt-get install -y \ | ||
curl \ | ||
ca-certificates \ | ||
sudo \ | ||
git \ | ||
bzip2 \ | ||
libx11-6 \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Create a working directory | ||
RUN mkdir /app | ||
|
||
# Set up the Conda environment and make python accessible via PATH. | ||
ENV CONDA_AUTO_UPDATE_CONDA=false | ||
ENV PATH=/miniconda:/miniconda/bin:$PATH | ||
COPY environment.yml /app/environment.yml | ||
RUN curl -sLo /miniconda.sh https://repo.continuum.io/miniconda/Miniconda3-py39_4.10.3-Linux-x86_64.sh \ | ||
&& chmod +x /miniconda.sh \ | ||
&& /miniconda.sh -b -p /miniconda \ | ||
&& rm /miniconda.sh \ | ||
&& /miniconda/bin/conda env update -n base -f /app/environment.yml \ | ||
&& rm /app/environment.yml \ | ||
&& /miniconda/bin/conda clean -ya | ||
|
||
# Need to export this for torch_geometric to find where cuda is. | ||
# See https://github.com/pyg-team/pytorch_geometric/issues/2040#issuecomment-766610625 | ||
ENV LD_LIBRARY_PATH="/miniconda/lib/:$LD_LIBRARY_PATH" | ||
|
||
# Check succes of environment creation. | ||
RUN python -c "import torch_geometric;" | ||
|
||
# Copy the repository content in /app | ||
WORKDIR /app | ||
COPY . . | ||
|
||
# Make RUN commands use the new environment: | ||
SHELL ["conda", "run", "-n", "myria3d", "/bin/bash", "-c"] | ||
|
||
# the entrypoint garanty that all command will be runned in the conda environment | ||
ENTRYPOINT ["conda", \ | ||
"run", \ | ||
"-n", \ | ||
"myria3d"] | ||
|
||
# Set the default command to bash for image inspection. | ||
CMD ["bash"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
configs/datamodule/transforms/preparations/no_random_subsampling.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# default preparations with grid sampling and random sampling. | ||
|
||
train: | ||
TargetTransform: | ||
_target_: myria3d.pctl.transforms.transforms.TargetTransform | ||
_args_: | ||
- ${dataset_description.classification_preprocessing_dict} | ||
- ${dataset_description.classification_dict} | ||
|
||
GridSampling: | ||
_target_: torch_geometric.transforms.GridSampling | ||
_args_: | ||
- 0.25 | ||
|
||
MinimumNumNodes: | ||
_target_: myria3d.pctl.transforms.transforms.MinimumNumNodes | ||
_args_: | ||
- 300 | ||
|
||
Center: | ||
_target_: torch_geometric.transforms.Center | ||
|
||
eval: | ||
TargetTransform: | ||
_target_: myria3d.pctl.transforms.transforms.TargetTransform | ||
_args_: | ||
- ${dataset_description.classification_preprocessing_dict} | ||
- ${dataset_description.classification_dict} | ||
|
||
CopyFullPreparedTargets: | ||
_target_: myria3d.pctl.transforms.transforms.CopyFullPreparedTargets | ||
|
||
CopyFullPos: | ||
_target_: myria3d.pctl.transforms.transforms.CopyFullPos | ||
|
||
GridSampling: | ||
_target_: torch_geometric.transforms.GridSampling | ||
_args_: | ||
- 0.25 | ||
|
||
MinimumNumNodes: | ||
_target_: myria3d.pctl.transforms.transforms.MinimumNumNodes | ||
_args_: | ||
- 300 | ||
|
||
# For interpolation | ||
CopySampledPos: | ||
_target_: myria3d.pctl.transforms.transforms.CopySampledPos | ||
|
||
Center: | ||
_target_: torch_geometric.transforms.Center | ||
|
||
predict: | ||
CopyFullPos: | ||
_target_: myria3d.pctl.transforms.transforms.CopyFullPos | ||
|
||
GridSampling: | ||
_target_: torch_geometric.transforms.GridSampling | ||
_args_: | ||
- 0.25 | ||
|
||
MinimumNumNodes: | ||
_target_: myria3d.pctl.transforms.transforms.MinimumNumNodes | ||
_args_: | ||
- 300 | ||
|
||
CopySampledPos: | ||
_target_: myria3d.pctl.transforms.transforms.CopySampledPos | ||
|
||
Center: | ||
_target_: torch_geometric.transforms.Center |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# @package _global_ | ||
|
||
# Nota : call "python myria3d/pctl/dataset/toy_dataset.py" to create a toy dataset before running this. | ||
defaults: | ||
- override /datamodule/transforms/augmentations: none.yaml | ||
|
||
|
||
logger: | ||
comet: | ||
experiment_name: "RandLaNetOverfit" | ||
|
||
trainer: | ||
min_epochs: 100 | ||
max_epochs: 100 | ||
overfit_batches: 1 | ||
num_sanity_val_steps: 0 | ||
|
||
datamodule: | ||
batch_size: 6 | ||
num_workers: 2 | ||
# runtime.cwd is where application is run from e.g. where run.py is. | ||
data_dir: "${hydra:runtime.cwd}/tests/data/" | ||
split_csv_path: "${hydra:runtime.cwd}/tests/data/toy_dataset_src/toy_dataset_split.csv" | ||
hdf5_file_path: "${hydra:runtime.cwd}/tests/data/toy_dataset.hdf5" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# @package _global_ | ||
|
||
# Nota : call "python myria3d/pctl/dataset/toy_dataset.py" to create a toy dataset before running this. | ||
defaults: | ||
- override /model: pyg_randla_net_model.yaml | ||
- override /datamodule/transforms/preparations: no_random_subsampling.yaml | ||
|
||
|
||
logger: | ||
comet: | ||
experiment_name: "RandLaNetOverfit" | ||
|
||
trainer: | ||
min_epochs: 100 | ||
max_epochs: 100 | ||
overfit_batches: 1 | ||
num_sanity_val_steps: 0 | ||
|
||
datamodule: | ||
batch_size: 12 | ||
num_workers: 2 | ||
# runtime.cwd is where application is run from e.g. where run.py is. | ||
data_dir: "${hydra:runtime.cwd}/tests/data/" | ||
split_csv_path: "${hydra:runtime.cwd}/tests/data/toy_dataset_src/toy_dataset_split.csv" | ||
hdf5_file_path: "${hydra:runtime.cwd}/tests/data/toy_dataset.hdf5" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# @package _global_ | ||
|
||
# Nota : call "python myria3d/pctl/dataset/toy_dataset.py" to create a toy dataset before running this. | ||
defaults: | ||
- override /model: pyg_randla_net_model.yaml | ||
- override /datamodule/transforms/augmentations: none.yaml | ||
|
||
|
||
logger: | ||
comet: | ||
experiment_name: "RandLaNetOverfit" | ||
|
||
trainer: | ||
min_epochs: 100 | ||
max_epochs: 100 | ||
overfit_batches: 1 | ||
num_sanity_val_steps: 0 | ||
|
||
datamodule: | ||
batch_size: 12 | ||
num_workers: 2 | ||
# runtime.cwd is where application is run from e.g. where run.py is. | ||
data_dir: "${hydra:runtime.cwd}/tests/data/" | ||
split_csv_path: "${hydra:runtime.cwd}/tests/data/toy_dataset_src/toy_dataset_split.csv" | ||
hdf5_file_path: "${hydra:runtime.cwd}/tests/data/toy_dataset.hdf5" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
configs/experiment/RandLaNet_base_run_FR_pyg_randla_net-MultiGPU.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# @package _global_ | ||
defaults: | ||
- RandLaNet_base_run_FR_pyg_randla_net.yaml | ||
|
||
logger: | ||
comet: | ||
experiment_name: "Pyg RandLaNet - FR Data - 2xGPUs" | ||
|
||
trainer: | ||
strategy: ddp_find_unused_parameters_false | ||
# Replace by gpu to simulate multi-gpus training. | ||
accelerator: gpu | ||
num_processes: 2 | ||
gpus: 2 | ||
|
||
datamodule: | ||
# You may want to divide batch size by number of gpus to keep number of steps by epoch unchanged. | ||
batch_size: 16 |
Oops, something went wrong.