Skip to content

Commit

Permalink
Update minor bug
Browse files Browse the repository at this point in the history
  • Loading branch information
heyufan1995 committed Jun 27, 2024
1 parent 86f0ae9 commit 7be2c60
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 33 deletions.
6 changes: 6 additions & 0 deletions scripts/gui.py → scripts/debugger.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ def generate_mask(self):
prompt_class = None
neg_id, pos_id = get_point_label(1)
else:
if self.class_label in [2, 20, 21]:
messagebox.showwarning(
"Warning",
"Current debugger skip kidney (2), lung (20), and bone (21). Use their subclasses.",
)
return
label_prompt = int(self.class_label)
neg_id, pos_id = get_point_label(label_prompt)
label_prompt = np.array([label_prompt])[np.newaxis, ...]
Expand Down
34 changes: 2 additions & 32 deletions scripts/infer.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,45 +25,15 @@
from monai.bundle import ConfigParser
from monai.bundle.scripts import _pop_args, _update_args
from monai.data import decollate_batch, list_data_collate, partition_dataset
from monai.utils import optional_import, RankFilter
from monai.utils import optional_import

from vista3d import vista_model_registry

from .sliding_window import point_based_window_inferer, sliding_window_inference
from .utils.trans_utils import get_largest_connected_component_point, VistaPostTransform
# from .train import CONFIG
from .train import CONFIG
rearrange, _ = optional_import("einops", name="rearrange")
RankFilter, _ = optional_import("monai.utils", name="RankFilter")
sys.path.insert(0, os.path.abspath(os.path.dirname(__file__)))
CONFIG = {
"version": 1,
"disable_existing_loggers": False,
"formatters": {"monai_default": {"format": DEFAULT_FMT}},
"loggers": {
"monai.apps.auto3dseg.auto_runner": {
"handlers": ["file", "console"],
"level": "DEBUG",
"propagate": False,
}
},
"filters": {"rank_filter": {"{}": RankFilter}},
"handlers": {
"file": {
"class": "logging.FileHandler",
"filename": "runner.log",
"mode": "a", # append or overwrite
"level": "DEBUG",
"formatter": "monai_default",
"filters": ["rank_filter"],
},
"console": {
"class": "logging.StreamHandler",
"level": "INFO",
"formatter": "monai_default",
"filters": ["rank_filter"],
},
},
}
IGNORE_PROMPT = set(
[
2, # kidney
Expand Down
2 changes: 1 addition & 1 deletion scripts/train_finetune.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
from monai.data import DataLoader, DistributedSampler
from monai.metrics import compute_dice
from monai.networks.utils import copy_model_state
from monai.utils import set_determinism, RankFilter
from monai.utils import set_determinism
from torch.nn.parallel import DistributedDataParallel
from torch.utils.tensorboard import SummaryWriter
from tqdm import tqdm
Expand Down

0 comments on commit 7be2c60

Please sign in to comment.