Apr-22-2021, 05:11 PM
(This post was last modified: Apr-22-2021, 05:22 PM by Led_Zeppelin.)
I have a question about the following python 3 code.
I also assume that when the actual values are put in they must be put in quotes and directories separated by backslashes.
Any help appreciated. Thanks in advance.
The paper that I am referring to can be found at this link.
https://medium.com/analytics-vidhya/how-...5b0c36e66e
Respectfully,
LZ
def _create_df(path, directory): """ Creates a df (with shuffled entries) with two columns: file name and label (0: normal or 1: pneumonia) """ files1 = glob.glob (path + directory + "/NORMAL/*.jpeg") files2 = glob.glob (path + directory + "/PNEUMONIA/*.jpeg") # creating the train set df_n = pd.DataFrame() df_p = pd.DataFrame() df_n['name'] = [x for x in files1] df_n['outcome'] = 0 df_p['name'] = [x for x in files2] df_p['outcome'] = 1. df = pd.concat([df_n, df_p], axis = 0, ignore_index = True) df = shuffle(df) # shuffle the dataset return df def create_x_and_y(self): X = np.array([img_preprocess(p) for p in self.train_df.name.values]) y = train_df.outcome.values return X, yThe question concerns the two inputs, path and directory. I assumed until now that a path is made-up of directories.
I also assume that when the actual values are put in they must be put in quotes and directories separated by backslashes.
Any help appreciated. Thanks in advance.
The paper that I am referring to can be found at this link.
https://medium.com/analytics-vidhya/how-...5b0c36e66e
Respectfully,
LZ