Skip to content

Commit 85549ce

Browse files
committed
Set training to load weights w/ strict
1 parent 990ac97 commit 85549ce

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

napari_cellseg3d/code_models/worker_training.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,8 @@ def get_loader_func(num_samples):
534534
torch.load(
535535
weights,
536536
map_location=self.config.device,
537-
)
537+
),
538+
strict=True,
538539
)
539540
except RuntimeError as e:
540541
logger.error(f"Error when loading weights : {e}")

napari_cellseg3d/dev_scripts/crop_data.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,24 +40,24 @@ def crop_3d_image(image, roi_size):
4040
Path().home()
4141
# / "Desktop/Code/CELLSEG_BENCHMARK/TPH2_DATA/somatomotor_iso"
4242
# / "Desktop/Code/CELLSEG_BENCHMARK/TPH2_DATA/somatomotor_iso/labels/semantic"
43-
/ "Desktop/Code/CELLSEG_BENCHMARK/TPH2_mesospim/BENCHMARK/visual_small"
43+
/ "Desktop/Code/CELLSEG_BENCHMARK/TPH2_mesospim/visual_iso/labels/semantic"
4444
)
4545
if not image_path.exists() or not image_path.is_dir():
4646
raise ValueError(f"Image path {image_path} does not exist")
4747
image_list = image_path.glob("*.tif")
4848
for j in image_list:
4949
print(j)
5050
image = imread(str(j))
51-
# crops = crop_3d_image(image, (64, 64, 64))
52-
crops = [image]
51+
crops = crop_3d_image(image, (64, 64, 64))
52+
# crops = [image]
5353
# viewer = napari.Viewer()
5454
if not (image_path / "cropped").exists():
5555
(image_path / "cropped").mkdir(exist_ok=False)
5656
for i, im in enumerate(crops):
5757
print(im.shape)
5858
# viewer.add_image(im)
5959
imwrite(
60-
str(image_path / f"cropped/{j.stem}_{i}_crop.tif"),
60+
str(image_path / f"cropped/a_{j.stem}_{i}_crop.tif"),
6161
im.astype(np.float32),
6262
dtype="float32",
6363
)

0 commit comments

Comments
 (0)