mhamilton723 / STEGO

Unsupervised Semantic Segmentation by Distilling Feature Correspondences
MIT License
711 stars 142 forks source link

demo_segmentation.py output being black #90

Open Lance4Liu opened 7 months ago

Lance4Liu commented 7 months ago

I train the models using train_segmentation.py, with train_config.yml being:

output_root: '../'
pytorch_data_dir: '../'
experiment_name: "exp3"
log_dir: "cocostuff27"
azureml_logging: True
submitting_to_aml: False

# Loader params
num_workers: 0
max_steps: 5000
batch_size: 16

num_neighbors: 7
dataset_name: "directory"

# Used if dataset_name is directory
dir_dataset_name: "dataset_brain"
dir_dataset_n_classes: 3

has_labels: False
crop_type: None
crop_ratio: .5
res: 224
loader_crop_type: "center"

# Model Params
extra_clusters: 0
use_true_labels: False
use_recalibrator: False
model_type: "vit_small"
arch: "dino"
use_fit_model: False
dino_feat_type: "feat"
projection_type: "nonlinear"
#projection_type: linear
dino_patch_size: 8
granularity: 1
continuous: True
dim: 70
dropout: True
zero_clamp: True

lr: 5e-4
pretrained_weights: ~
use_salience: False
stabalize: False
stop_at_zero: True

# Feature Contrastive params
pointwise: True
feature_samples: 11
neg_samples: 5
aug_alignment_weight: 0.0

correspondence_weight: 1.0

# IAROA vit small 1/31/22
neg_inter_weight: 0.63
pos_inter_weight: 0.25
pos_intra_weight: 0.67
neg_inter_shift: 0.46
pos_inter_shift: 0.12
pos_intra_shift: 0.18

rec_weight: 0.0
repulsion_weight: 0.0

# CRF Params
crf_weight: 0.0
alpha: .5
beta: .15
gamma: .05
w1: 10.0
w2: 3.0
shift: 0.00
crf_samples: 1000
color_space: "rgb"

reset_probe_steps: ~

# Logging params
n_images: 5
scalar_log_freq: 10
checkpoint_freq: 50
val_freq: 100
hist_freq: 100

hydra:
  run:
    dir: "."
  output_subdir: ~
  #job_logging: "disabled"
  #hydra_logging: "disabled"

Then I run the demo_segmentation.py with demo_config.yml being:

output_root: '../'
model_path: "../checkpoints/cocostuff27/directory_exp3_date_Jan18_23-39-07/epoch=57-step=799.ckpt"
image_dir: "../test_brain"
experiment_name: "exp3"
res: 320
batch_size: 8
num_workers: 0
use_ddp: False

hydra:
  run:
    dir: "."
  output_subdir: ~
  #job_logging: "disabled"
  #hydra_logging: "disabled"

But the output in results\predictions\cluster is totally dark. Can someone tell me what should I do for this? More epoches? Or some paths in the configs should be edited? I train the epoch for about 50.