我的图像有错误,但不知道如何解决。谁能帮我一下吗
错误:
<;类“pandas.core.frame.DataFrame”>; 范围索引:3929个条目,0到3928 数据列(共4列):
0患者id 3929非空对象 1图像路径3929非空对象 2掩码_路径3929非空对象 3掩码3929非空int64 数据类型:int64(1),对象(3) 内存使用率:122.9+KB <;类“pandas.core.frame.DataFrame”>; 范围索引:3929个条目,0到3928 数据列(共4列):
0患者id 3929非空对象 1图像路径3929非空对象 2掩码_路径3929非空对象 3掩码3929非空int64 数据类型:int64(1),对象(3) 内存使用率:122.9+KB 病人身份证。。。面具 0 TCGA_CS_5395_19981004。。。0 1 TCGA_CS_5395_19981004。。。0 2 TCGA_CS_5395_19981004。。。0 3 TCGA_CS_5395_19981004。。。0 4 TCGA_CS_5395_19981004。。。0 ... ... ... ... 3924 TCGA_DU_6401_19831001。。。0 3925 TCGA_DU_6401_19831001。。。0 3926 TCGA_DU_6401_19831001。。。0 3927 TCGA_DU_6401_19831001。。。0 3928 TCGA_DU_6401_19831001。。。0
[3929行x 4列]
int64索引([0,1],dtype='int64')
0 TCGA_CS_5395_19981004/TCGA_CS_5395_19981004_1_。。。
1 TCGA_CS_4944_20010208/TCGA_CS_4944_20010208_1_。。。
2 TCGA_CS_4941_19960909/TCGA_CS_4941_19960909_1_。。。
3 TCGA_CS_4943_20000902/TCGA_CS_4943_20000902_1。。。
4 TCGA_CS_5396_20010302/TCGA_CS_5396_20010302_1_。。。
…
3924 TCGA_HT_A61B_19991127/TCGA_HT_A61B_19991127_86。。。
3925 TCGA_HT_A61A_20000127/TCGA_HT_A61A_20000127_87。。。
3926 TCGA_HT_A61B_19991127/TCGA_HT_A61B_19991127_87。。。
3927 TCGA_HT_A61A_20000127/TCGA_HT_A61A_20000127_88。。。
3928 TCGA_HT_A61B_19991127/TCGA_HT_A61B_19991127_88。。。
名称:掩码路径,长度:3929,数据类型:object
0 TCGA_CS_5395_19981004/TCGA_CS_5395_19981004_1.tif
1 TCGA_CS_4944_20010208/TCGA_CS_4944_20010208_1.tif
2 TCGA_CS_4941_19960909/TCGA_CS_4941_19960909_1.tif
3 TCGA_CS_4943_20000902/TCGA_CS_4943_20000902_1.tif
4 TCGA_CS_5396_20010302/TCGA_CS_5396_20010302_1.tif
…
3924 TCGA_HT_A61B_19991127/TCGA_HT_A61B_19991127_86。。。
3925 TCGA_HT_A61A_20000127/TCGA_HT_A61A_20000127_87。。。
3926 TCGA_HT_A61B_19991127/TCGA_HT_A61B_19991127_87。。。
3927 TCGA_HT_A61A_20000127/TCGA_HT_A61A_20000127_88。。。
3928 TCGA_HT_A61B_19991127/TCGA_HT_A61B_19991127_88。。。
名称:图像路径,长度:3929,数据类型:object
回溯(最近一次呼叫最后一次): 文件“C:\STUDIES\AI MASTER CLASS\P96-Section-3-Healthcare-AI\Healthcare_AI.py”,第119行,在 plt.imshow(cv2.imread(brain\u df.mask\u path[623])) 文件“C:\Users\lahoa\AppData\Local\Programs\Python\37\lib\site packages\matplotlib\pyplot.py”,第2730行,在imshow中 **kwargs) 文件“C:\Users\lahoa\AppData\Local\Programs\Python\Python37\lib\site packages\matplotlib\uem>init\uuuz.py”,第1447行,在内部 return func(ax,*map(sanitize_序列,args),**kwargs) 文件“C:\Users\lahoa\AppData\Local\Programs\Python\37\lib\site packages\matplotlib\axes\u axes.py”,第5523行,在imshow中 im.set_数据(X) 文件“C:\Users\lahoa\AppData\Local\Programs\Python\37\lib\site packages\matplotlib\image.py”,第703行,在set\u数据中 “float”。格式(self.\u A.dtype)) TypeError:无法将dtype对象的图像数据转换为浮点
代码:
import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt
import zipfile
import cv2
from skimage import io
import tensorflow as tf
from tensorflow.python.keras import Sequential
from tensorflow.keras import layers, optimizers
from tensorflow.keras.applications import DenseNet121
from tensorflow.keras.applications.resnet50 import ResNet50
from tensorflow.keras.layers import *
from tensorflow.keras.models import Model, load_model
from tensorflow.keras.initializers import glorot_uniform
from tensorflow.keras.utils import plot_model
from tensorflow.keras.callbacks import ReduceLROnPlateau, EarlyStopping, ModelCheckpoint, LearningRateScheduler
from IPython.display import display
from tensorflow.keras import backend as K
from sklearn.preprocessing import StandardScaler, normalize
import os
import glob
import random
brain_df = pd.read_csv('./Healthcare+AI+Datasets/Healthcare AI Datasets/Brain_MRI/data_mask.csv')
brain_df.info()
brain_df.head(50)
brain_df.mask_path[1] # Path to the brain MRI image
brain_df.image_path[1] # Path to the segmentation mask
brain_df
brain_df['mask'].value_counts().index
# Use plotly to plot interactive bar chart
import plotly.graph_objects as go
fig = go.Figure([go.Bar(x = brain_df['mask'].value_counts().index, y = brain_df['mask'].value_counts())])
fig.update_traces(marker_color = 'rgb(0,200,0)', marker_line_color = 'rgb(0,255,0)',
marker_line_width = 7, opacity = 0.6)
fig.show()
brain_df.info()
brain_df.head(50)
brain_df.mask_path[1]
brain_df.image_path[1]
print(brain_df)
print(brain_df['mask'].value_counts().index)
# Use plotly to plot interactive bar chart
import plotly.graph_objects as go
fig = go.Figure([go.Bar(x = brain_df['mask'].value_counts().index, y = brain_df['mask'].value_counts())])
fig.update_traces(marker_color = 'rgb(0,200,0)', marker_line_color = 'rgb(0,255,0)',
marker_line_width = 7, opacity = 0.6)
fig.show()
print(brain_df.mask_path)
print(brain_df.image_path)
plt.imshow(cv2.imread(brain_df.mask_path[623]))
目前没有回答
相关问题 更多 >
编程相关推荐