bowang-lab / MedSAMSlicer

3D Slicer Plugin for Segment anything in medical images
https://www.nature.com/articles/s41467-024-44824-z
173 stars 20 forks source link

Problem of install and using SAM2 slicer plug-in #45

Open huanaih11 opened 3 weeks ago

huanaih11 commented 3 weeks ago

python infer_video_tiny_debug.py --img_path 'img_data.npz' --gts_path X --propagate N --checkpoint tiny

When I'm running this it reply: python infer_video_tiny_debug.py --img_path 'img_data.npz' --gts_path X --propagate N --checkpoint tiny ["'img_data.npz'"] 0it [00:00, ?it/s]infering 'img_data.npz' 0it [00:00, ?it/s] Traceback (most recent call last): File "C:\Users\huanai\MedSAMSlicer\infer_video_tiny_debug.py", line 300, in infer_3d(img_npz_file, gts_file, propagate) File "C:\Users\huanai\AppData\Roaming\Python\Python311\site-packages\torch\utils_contextlib.py", line 116, in decorate_context return func(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\huanai\MedSAMSlicer\infer_video_tiny_debug.py", line 207, in infer_3d npz_data = np.load(img_npz_file, 'r', allow_pickle=True) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\huanai\AppData\Roaming\Python\Python311\site-packages\numpy\lib\npyio.py", line 427, in load fid = stack.enter_context(open(os_fspath(file), "rb")) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ FileNotFoundError: [Errno 2] No such file or directory: "'img_data.npz'"

I followed step-by-step of install videos, can you please help me to solve this problem? I have no idea how to fix it.

rasakereh commented 3 weeks ago

SAM2 development is discontinued and MedSAM2 has replaced it. Can you try with this version and let me know if the problem is still there. Link: https://github.com/bowang-lab/MedSAMSlicer/tree/MedSAM2

Make sure that you are using a clean workspace for installation to prevent collisions with SAM2

huanaih11 commented 3 weeks ago

Thank you for your reply.

For the new one, when I want to download the checkpoints, it shows: Invoke-WebRequest : 未能找到路径“C:\MedSAMSlicer\checkpoints\2.1\sam2_hiera_tiny.pt”的一部分。 所在位置 C:\MedSAMSlicer\extra_files.ps1:10 字符: 1

Downloading sam2_hiera_small.pt checkpoint... Invoke-WebRequest : 未能找到路径“C:\MedSAMSlicer\checkpoints\2.1\sam2_hiera_small.pt”的一部分。 所在位置 C:\MedSAMSlicer\extra_files.ps1:13 字符: 1 + Invoke-WebRequest -Uri $sam2_hiera_s_url -OutFile "checkpoints\2.1\sa ... + ~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Invoke-WebRequest], DirectoryNotFoundException + FullyQualifiedErrorId : System.IO.DirectoryNotFoundException,Microsoft.PowerShell.Commands.InvokeWebRequestComma nd

Downloading sam2_hiera_base_plus.pt checkpoint... Invoke-WebRequest : 未能找到路径“C:\MedSAMSlicer\checkpoints\2.1\sam2_hiera_base_plus.pt”的一部分。 所在位置 C:\MedSAMSlicer\extra_files.ps1:16 字符: 1

Downloading sam2_hiera_large.pt checkpoint... Invoke-WebRequest : 未能找到路径“C:\MedSAMSlicer\checkpoints\2.1\sam2_hiera_large.pt”的一部分。 所在位置 C:\MedSAMSlicer\extra_files.ps1:19 字符: 1

All checkpoints are downloaded successfully. Downloading config files... Config files downloaded successfully.

And from previous step also showed one error:

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. matplotlib 3.9.1.post1 requires python-dateutil>=2.7, which is not installed.