Skip to content

Commit

Permalink
spseg refac code readme
Browse files Browse the repository at this point in the history
  • Loading branch information
chrischoy committed May 5, 2020
1 parent 0b3ad50 commit 966a3e3
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 30 deletions.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) Chris Choy ([email protected])

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@

This repository contains the accompanying code for [4D-SpatioTemporal ConvNets: Minkowski Convolutional Neural Networks, CVPR'19](https://arxiv.org/abs/1904.08755).

## Change Logs

- 2020-05-04: As pointed out by Thomas Chaton on [Issue#30](https://github.com/chrischoy/SpatioTemporalSegmentation/issues/30), I also found out that the training script contains bugs that models cannot reach the target performance described in the Model Zoo with the latest MinkowskiEngine. I am in the process of debugging the bugs, but I am having some difficulty finding the bugs. So, I created another git repo [SpatioTemporalSegmentation-ScanNet](https://github.com/chrischoy/SpatioTemporalSegmentation-ScanNet) from my other private repo that reaches the target performance. Please refer to the [SpatioTemporalSegmentation-ScanNet](https://github.com/chrischoy/SpatioTemporalSegmentation-ScanNet) for the ScanNet training. I'll update this repo once I find the bugs and merge SpatioTemporalSegmentation-ScanNet with this repo. Sorry for the trouble.

## Requirements

Expand All @@ -27,9 +30,9 @@ First, install pytorch following the [instruction](https://pytorch.org). Next, i
```
sudo apt install libopenblas-dev
pip3 install torch torchvision
pip install torch torchvision
pip3 install -U MinkowskiEngine
pip install -U git+https://github.com/StanfordVL/MinkowskiEngine
```

Next, clone the repository and install the rest of the requirements
Expand Down
2 changes: 1 addition & 1 deletion lib/datasets/scannet.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def __init__(self,
data_root = config.scannet_path
if phase not in [DatasetPhase.Train, DatasetPhase.TrainVal]:
self.CLIP_BOUND = self.TEST_CLIP_BOUND
data_paths = read_txt(os.path.join('./splits/scannet', self.DATA_PATH_FILE[phase]))
data_paths = read_txt(os.path.join(data_root, self.DATA_PATH_FILE[phase]))
logging.info('Loading {}: {}'.format(self.__class__.__name__, self.DATA_PATH_FILE[phase]))
super().__init__(
data_paths,
Expand Down
7 changes: 0 additions & 7 deletions lib/voxelizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,6 @@ def voxelize(self, coords, feats, labels, center=None):
homo_coords = np.hstack((coords, np.ones((coords.shape[0], 1), dtype=coords.dtype)))
coords_aug = np.floor(homo_coords @ rigid_transformation.T[:, :3])

# Align all coordinates to the origin.
min_coords = coords_aug.min(0)
M_t = np.eye(4)
M_t[:3, -1] = -min_coords
rigid_transformation = M_t @ rigid_transformation
coords_aug = np.floor(coords_aug - min_coords)

# key = self.hash(coords_aug) # floor happens by astype(np.uint64)
coords_aug, feats, labels = ME.utils.sparse_quantize(
coords_aug, feats, labels=labels, ignore_label=self.ignore_label)
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ datetime
tqdm
retrying
easydict
open3d
27 changes: 7 additions & 20 deletions scripts/train_scannet.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,13 @@ export PYTHONUNBUFFERED="True"
export CUDA_VISIBLE_DEVICES=$1

export BATCH_SIZE=${BATCH_SIZE:-9}
export MAX_ITER=${MAX_ITER:-120000}
export MODEL=${MODEL:-Res16UNet34C}
export DATASET=${DATASET:-ScannetVoxelization2cmDataset}

export TIME=$(date +"%Y-%m-%d_%H-%M-%S")

export LOG_DIR=./outputs/ScanNet$2/$TIME
export LOG_DIR=./outputs/$DATASET/$MODEL-b$BATCH_SIZE-$MAX_ITER-$2/$TIME

# Save the experiment detail and dir to the common log file
mkdir -p $LOG_DIR
Expand All @@ -22,28 +25,12 @@ LOG="$LOG_DIR/$TIME.txt"

python -m main \
--log_dir $LOG_DIR \
--dataset ScannetVoxelization2cmDataset \
--model Res16UNet34C \
--dataset $DATASET \
--model $MODEL \
--lr 1e-1 \
--batch_size $BATCH_SIZE \
--scheduler PolyLR \
--max_iter 120000 \
--max_iter $MAX_ITER \
--train_limit_numpoints 1200000 \
--train_phase train \
$3 2>&1 | tee -a "$LOG"

export TIME=$(date +"%Y-%m-%d_%H-%M-%S")
LOG="$LOG_DIR/$TIME.txt"

python -m main \
--log_dir $LOG_DIR \
--dataset ScannetVoxelization2cmDataset \
--model Res16UNet34C \
--lr 1e-2 \
--batch_size $BATCH_SIZE \
--scheduler PolyLR \
--max_iter 120000 \
--train_limit_numpoints 1200000 \
--train_phase trainval \
--weights $LOG_DIR/weights.pth \
$3 2>&1 | tee -a "$LOG"

0 comments on commit 966a3e3

Please sign in to comment.