Skip to content

Added use_openvino attribute of FlarePredictor class#3019

Open
aiman-627 wants to merge 2 commits into
MIC-DKFZ:masterfrom
aiman-627:flare24-task2-fix
Open

Added use_openvino attribute of FlarePredictor class#3019
aiman-627 wants to merge 2 commits into
MIC-DKFZ:masterfrom
aiman-627:flare24-task2-fix

Conversation

@aiman-627
Copy link
Copy Markdown

No description provided.

@FabianIsensee FabianIsensee self-assigned this Apr 13, 2026
@FabianIsensee
Copy link
Copy Markdown
Member

@ykirchhoff can you please review this? I can merge it for you once you give your 👍

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
parser.add_argument("-no_openvino", action="store_true")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
predict_flare(args.input, args.output, args.model, not args.no_openvino)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def predict_flare(input_dir, output_dir, model_folder, use_openvino=True):

tile_step_size: float = 0.5,
use_gaussian: bool = True,
use_mirroring: bool = True,
perform_everything_on_device: bool = False,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
use_openvino: bool = True,
perform_everything_on_device: bool = False,

):
super().__init__(tile_step_size, use_gaussian, use_mirroring, perform_everything_on_device, device, verbose,
verbose_preprocessing, allow_tqdm)
self.use_openvino = True
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
self.use_openvino = True
self.use_openvino = use_openvino

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
checkpoint_name: str = 'checkpoint_final.pth'):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
predictor = FlarePredictor(tile_step_size=0.5, use_mirroring=False, device=torch.device("cpu")
use_openvino=use_openvino)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
predictor.initialize_from_trained_model_folder(model_folder, ("all",))

if use_folds is None:
use_folds = nnUNetPredictor.auto_detect_available_folds(model_training_output_dir, checkpoint_name)

dataset_json = load_json(join(model_training_output_dir, 'dataset.json'))
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
save_model = self.use_openvino and os.path.isfile(f"{model_training_output_dir}/model.xml")
dataset_json = load_json(join(model_training_output_dir, 'dataset.json'))

@ykirchhoff
Copy link
Copy Markdown
Member

Hi @aiman-627, I commented a few things in the code, which I think make sense to change as it didn't really make sense the way I had it before. It looks a bit ugly unfortunately and I don't like working with the review tab 😅. Could you take a look at these suggestions and incorporate them in your merge request?

@aiman-627
Copy link
Copy Markdown
Author

Hi @ykirchhoff, I've added the changes you suggested, but I didn't run it to make sure it still worked or anything since I don't have the libraries setup and everything in my fork repo. Please check to see if it's correct.

@ykirchhoff
Copy link
Copy Markdown
Member

Hi @aiman-627,

thanks for incorporating the changes. I will try running it and then approve it for the merge.

Best,
Yannick

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants