Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nnUNetv2_plan_and_preprocess: error: unrecognized arguments: --npfp 8 Exit code: 2 Preprocessing directory not created #2649

Open
Satakang483BIMIT opened this issue Dec 18, 2024 · 2 comments
Assignees

Comments

@Satakang483BIMIT
Copy link

NNU_Net_12_12_24 (2).md

Good morning, I am currently trying to create a detailed and well annotated script for training using nn-U-NETv2. The script is going include visualization of key metrics during training and give me key visual graphs/charts for model evaluation afterwards.

My goal is to train the model using labels already created from manually segmenting MRIs in the MONAI Label module of 3DSlicer.

Right now, I am running the script in Google Colab via Local Host.

image

Everything in the script runs as expected until this current block of code:

"# Modified preprocessing script with basic arguments
import os
import subprocess

cmd = "nnUNetv2_plan_and_preprocess -d 100 --verify_dataset_integrity --npfp 8"

try:

Run preprocessing with full output capture

result = subprocess.run(
cmd,
shell=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
text=True
)

print("Command Output:")
print(result.stdout)

print("\nError Output (if any):")
print(result.stderr)

Print exit code

print("\nExit code:", result.returncode)

Check if preprocessing succeeded

preprocessed_path = os.path.join(os.environ.get('nnUNet_preprocessed'), 'Dataset100_CSFSegmentation')
if os.path.exists(preprocessed_path):
print(f"\nPreprocessing completed successfully")
print("Contents:", os.listdir(preprocessed_path))
else:
print("\nPreprocessing directory not created")

except Exception as e:
print(f"Error running preprocessing: {e}")"

Resulting Output:

"Command Output:

Error Output (if any):
usage: nnUNetv2_plan_and_preprocess [-h] [-d D [D ...]] [-fpe FPE]
[-npfp NPFP] [--verify_dataset_integrity]
[--no_pp] [--clean] [-pl PL]
[-gpu_memory_target GPU_MEMORY_TARGET]
[-preprocessor_name PREPROCESSOR_NAME]
[-overwrite_target_spacing OVERWRITE_TARGET_SPACING [OVERWRITE_TARGET_SPACING ...]]
[-overwrite_plans_name OVERWRITE_PLANS_NAME]
[-c C [C ...]] [-np NP [NP ...]]
[--verbose]
nnUNetv2_plan_and_preprocess: error: unrecognized arguments: --npfp 8

Exit code: 2

Preprocessing directory not created"

I have attempted several troubleshooting fixes (in both the code itself & bash/Anaconda Powershell Prompt), such as:

  1. "nnUNetv2_plan_and_preprocess -d 100 --verify_dataset_integrity --clean -npfp 8"

RESULT: : AssertionError: Did not find the expected number of training cases (90). Found 1 instead.
Examples: ['CS']

  1. "nnUNetv2_plan_and_preprocess -d 100 --verify_dataset_integrity --clean"

RESULT: AssertionError: Did not find the expected number of training cases (90). Found 1 instead.
Examples: ['CS']

  1. "nnUNetv2_plan_and_preprocess -d 100 --verify_dataset_integrity --clean --np 8"
    RESULT: nnUNetv2_plan_and_preprocess: error: unrecognized arguments: --np 8

What further troubleshooting steps could I take to establish the preprocessing directory?

@Satakang483BIMIT
Copy link
Author

image Here is the result of the Current Google Colab code

@Satakang483BIMIT
Copy link
Author

dataset.json
Attached is the .json file in the "C:\Users\Administrator\Desktop\ColabNotebooks\nnUNet_raw\Dataset100" directory

image

image

image

image

Here are screengrabs of the dataset.json file:

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

No branches or pull requests

2 participants