x_train = []
for i in range(1, 4):
base_dir = f'/Users/name/Desktop/cancer_data/stage_1_png' #pathname that I copy-pasted
files = os.listdir(base_dir)
for file in tqdm(files):
img = imread(base_dir file)
x_train.append(img)
x_train = np.array(x_train)
x_train.shape
我從我想從中提取影像的檔案夾中復制粘貼了路徑名,這個完全相同的代碼以前作業過,但現在我收到錯誤訊息:
FileNotFoundError: [Errno 2] No such file or directory: '/Users/name/Desktop/cancer_data/stage_1_png'
我在檔案夾中按住 Option 鍵,然后單擊“copyPathname”(在 Mac 上)。所以它不可能是一個不存在的路徑/檔案夾。
uj5u.com熱心網友回復:
再次檢查檔案名。我認為它應該是stage_1.png而不是stage_1_png
uj5u.com熱心網友回復:
這是一個相對路徑。我更喜歡使用 r""。
shift right click在影像檔案上。你會找到一個copy path選項并使用它而不是路徑。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qiye/381037.html
標籤:Python 张量流 错误处理 jupyter-笔记本 蟒蛇
上一篇:層“sequential_3”的輸入0與層不兼容:expectedshape=(None,60),foundshape=(5,174)
