xhu248 / AutoSAM

finetuning SAM with non-promptable decoder on medical images
Apache License 2.0
114 stars 9 forks source link

ImportError: cannot import name 'SegDecoderViT' from 'models.SamFeatSeg' #2

Open yasaorder opened 1 year ago

yasaorder commented 1 year ago

Traceback (most recent call last): File "train.py", line 27, in from dataset import * File "D:\pycharmprogram\Medical-SAM-Adapter-main\dataset.py", line 19, in from utils import random_click File "D:\pycharmprogram\Medical-SAM-Adapter-main\utils.py", line 57, in from models.discriminator import Discriminator File "D:\anaconda\envs\MedSAM-adapter\lib\site-packages\modelsinit.py", line 3, in from .build_autosam_seg_model import sam_seg_model_registry File "D:\anaconda\envs\MedSAM-adapter\lib\site-packages\models\build_autosam_seg_model.py", line 5, in from .SamFeatSeg import SamFeatSeg, SegDecoderViT, SegDecoderCNN ImportError: cannot import name 'SegDecoderViT' from 'models.SamFeatSeg' (D:\anaconda\envs\MedSAM-adapter\lib\site-packages\models\SamFeatSeg.py)

yasaorder commented 1 year ago

我按照github上的安装环境的方法安装了,运行下面这个代码就跑出来这个错误了,请问是为什么啊 python scripts/main_autosam_seg.py --src_dir ${dataset/prepare_dataset/ACDC_png} --dist-url 'tcp://localhost:10002' \ --data_dir ${dataset/prepare_dataset/ACDC_png}/imgs/ --save_dir ./${dataset/prepare_dataset/save} \ --multiprocessing-distributed --world-size 1 --rank 0 -b 4 --dataset ACDC \ --fold ${fold} --tr_size ${tr_size} --model_type ${model_type} --num_classes 4

xhu248 commented 1 year ago

thank you for the remainder, it is a bug caused by removing unused codes in another dev version. We already fix it by removing SegDecoderViT from build_autosam_seg_model.py and build_sam_feat_seg_model.py