Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed several issues preventing launches with some environments #8

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,19 +130,19 @@ python train_selfsupervised.py ... cfg.network.backbone=SPVCNN
```bash

# 100%
python train_downstream_semseg.py cfg=nuscenes cfg.downstream.max_epochs=30 cfg.val_interval=5 cfg.downstream.skip_ratio=1
python also_selfsup/train_downstream_semseg.py cfg=nuscenes cfg.downstream.max_epochs=30 cfg.downstream.val_interval=5 cfg.downstream.skip_ratio=1

# 50%
python train_downstream_semseg.py cfg=nuscenes cfg.downstream.max_epochs=50 cfg.val_interval=5 cfg.downstream.skip_ratio=2
python also_selfsup/train_downstream_semseg.py cfg=nuscenes cfg.downstream.max_epochs=50 cfg.downstream.val_interval=5 cfg.downstream.skip_ratio=2

# 10%
python train_downstream_semseg.py cfg=nuscenes cfg.downstream.max_epochs=100 cfg.val_interval=10 cfg.downstream.skip_ratio=10
python also_selfsup/train_downstream_semseg.py cfg=nuscenes cfg.downstream.max_epochs=100 cfg.downstream.val_interval=10 cfg.downstream.skip_ratio=10

# 1%
python train_downstream_semseg.py cfg=nuscenes cfg.downstream.max_epochs=500 cfg.val_interval=50 cfg.downstream.skip_ratio=100
python also_selfsup/train_downstream_semseg.py cfg=nuscenes cfg.downstream.max_epochs=500 cfg.downstream.val_interval=50 cfg.downstream.skip_ratio=100

# 0.1%
python train_downstream_semseg.py cfg=nuscenes cfg.downstream.max_epochs=1000 cfg.val_interval=100 cfg.downstream.skip_ratio=1000
python also_selfsup/train_downstream_semseg.py cfg=nuscenes cfg.downstream.max_epochs=1000 cfg.downstream.val_interval=100 cfg.downstream.skip_ratio=1000
```

#### With pretrained models
Expand All @@ -154,7 +154,7 @@ python convert_models.py --ckpt path_to_pretraining_checkpoint

Second, run downstream training
```bash
python train_downstream_semseg.py cfg=nuscenes cfg.downstream.checkpoint_dir='path_to_checkpoint_directory' cfg.downstream.checkpoint_name='pretrained_backbone_XXX.ckpt'
python also_selfsup/train_downstream_semseg.py cfg=nuscenes cfg.downstream.checkpoint_dir='path_to_checkpoint_directory' cfg.downstream.checkpoint_name='pretrained_backbone_XXX.ckpt'
```

#### Evaluation of downstream models
Expand Down
16 changes: 5 additions & 11 deletions also_selfsup/eval.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import os
import numpy as np
import yaml
import logging
import argparse
Expand All @@ -14,7 +12,7 @@

from torch_geometric.data import DataLoader

from utils.utils import wblue, wgreen
from utils.utils import wgreen
from utils.confusion_matrix import ConfusionMatrix
from transforms import get_transforms, get_input_channels

Expand All @@ -25,7 +23,7 @@


if __name__ == "__main__":
warnings.filterwarnings("ignore", category=UserWarning)
warnings.filterwarnings("ignore", category=UserWarning)

logging.getLogger().setLevel("INFO")

Expand All @@ -41,7 +39,7 @@
DatasetClass = eval("datasets."+config["dataset_name"])
test_transforms = get_transforms(config, train=False, downstream=True, keep_orignal_data=True)
test_dataset = DatasetClass(config["dataset_root"],
split=opts.split,
split=opts.split,
transform=test_transforms,
)

Expand All @@ -54,12 +52,10 @@
follow_batch=["voxel_coords"]
)


num_classes = config["downstream"]["num_classes"]
device = torch.device("cuda")


logging.info("Network")
logging.info("Network")
if config["network"]["backbone_params"] is None:
config["network"]["backbone_params"] = {}
config["network"]["backbone_params"]["in_channels"] = get_input_channels(config["inputs"])
Expand All @@ -73,11 +69,10 @@
net = eval(backbone_name)(**config["network"]["backbone_params"])
net.to(device)
net.eval()

logging.info("Loading the weights from pretrained network")
net.load_state_dict(torch.load(opts.ckpt), strict=True)


cm = ConfusionMatrix(num_classes, 0)
with torch.no_grad():
t = tqdm(test_loader, ncols=100)
Expand Down Expand Up @@ -113,4 +108,3 @@
logging.info(f"MIoU: {miou}")
logging.info(f"FIoU: {freqweighted_iou}")
logging.info(f"IoU per class: {iou_per_class}")

Loading