Skip to content

Commit

Permalink
Reorganized editor widgets
Browse files Browse the repository at this point in the history
  • Loading branch information
fercer committed Jul 26, 2024
1 parent d4b0715 commit b8ffcc5
Show file tree
Hide file tree
Showing 5 changed files with 220 additions and 163 deletions.
12 changes: 6 additions & 6 deletions src/napari_activelearning/_acquisition.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
try:
import torch
from torch.utils.data import DataLoader
USING_TORCH = True
USING_PYTORCH = True
except ModuleNotFoundError:
USING_TORCH = False
USING_PYTORCH = False

import napari
from napari.layers._multiscale_data import MultiScaleData
Expand Down Expand Up @@ -123,7 +123,7 @@ def add_multiscale_output_layer(
return output_channel


if USING_TORCH:
if USING_PYTORCH:
class DropoutEvalOverrider(torch.nn.Module):
def __init__(self, dropout_module):
super(DropoutEvalOverrider, self).__init__()
Expand Down Expand Up @@ -239,7 +239,7 @@ def fine_tune(self, dataset_metadata_list: Iterable[
shuffle=True,
)

if USING_TORCH:
if USING_PYTORCH:
dataloader = DataLoader(
dataset,
num_workers=self._num_workers,
Expand All @@ -256,7 +256,7 @@ def fine_tune(self, dataset_metadata_list: Iterable[
)

for img, lab in dataloader:
if USING_TORCH:
if USING_PYTORCH:
img = img[0].numpy()
lab = lab[0].numpy()

Expand Down Expand Up @@ -453,7 +453,7 @@ def compute_acquisition(self, dataset_metadata, acquisition_fun,

self._reset_patch_progressbar()
for pos, img, img_sp in dl:
if USING_TORCH:
if USING_PYTORCH:
pos = pos[0].numpy()
img = img[0].numpy()
img_sp = img_sp[0].numpy()
Expand Down
Loading

0 comments on commit b8ffcc5

Please sign in to comment.