Open Doris1039 opened 3 years ago
The pickle file we generated contains the images for training and testing. You can generate the dataset in any form as your wish. We will upload the python script for generating pickle file.
The pickle file we generated contains the images for training and testing. You can generate the dataset in any form as your wish. We will upload the python script for generating pickle file.
Thanks a lot!
Hi Authors, I'm getting the following error when running 'train_my_model' file., 'No such file or directory: 'data/ACD/Szada/train_sample_1.pickle'' I noticed that in your code there is a load_train_data and load_test data function.
Could you please help with that? Thanks a lot.
dear DORIS IM stocked in this ditch like problem. did u find an answer?
Hi Authors, I'm getting the following error when running 'train_my_model' file., 'No such file or directory: 'data/ACD/Szada/train_sample_1.pickle'' I noticed that in your code there is a load_train_data and load_test data function.
Could you please help with that? Thanks a lot.
Hi.I still haven't found the python script for generating pickle file.Could you please tell me how you solved this problem?thanks a lot!
Hi, I met the same problem and I solved this. You can read all train data and dump it into a pickle file using file get_sample.py inside folder Supervised.
Hi, I am sorry for our late reply. Actually, the pickle files are generated from your used datasets. You can use other ways to define your dataset. The script for generating pickle file will be uploaded soon. Sincerely. I-Hope-Peace
On Sat, Feb 27, 2021 at 3:59 PM Le Minh Khoa notifications@github.com wrote:
Hi, I met the same problem and I'm unable to solve this. Can you please give me the generating pickle script.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/I-Hope-Peace/DSMSCN/issues/3#issuecomment-787032515, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQFWQ7IS3IRFWTOPCYQURPDTBCQ7ZANCNFSM4VDW26HQ .
def load_test_data(): file = open("data/Szada/test_sample_1.pickle", "rb") test_X = pickle.load(file) file.close() file = open("data/Szada/test_sample_2.pickle", "rb") test_Y = pickle.load(file) file.close() file = open("data/Szada/test_label.pickle", "rb") test_label = pickle.load(file) file.close() return test_X, test_Y, test_label
Try this code...It worked for me. ->Another way to load pickle data ->Once check your pickle format where you write and read pickle data ->It should be .pkl or .pickle but should be same at both places
Hello! Thank you very much for your sharing!But one of my problems is that I don't know how to save the images in the data set as pickle files.How do you solve this problem?Can you give me some Pointers?Thank you very much!
------------------ 原始邮件 ------------------ 发件人: "I-Hope-Peace/DSMSCN" @.>; 发送时间: 2021年3月12日(星期五) 上午7:38 @.>; @.**@.>; 主题: Re: [I-Hope-Peace/DSMSCN] "train_sample_1.pickle" in code (#3)
def load_test_data(): file = open("data/Szada/test_sample_1.pickle", "rb") test_X = pickle.load(file) file.close() file = open("data/Szada/test_sample_2.pickle", "rb") test_Y = pickle.load(file) file.close() file = open("data/Szada/test_label.pickle", "rb") test_label = pickle.load(file) file.close() return test_X, test_Y, test_label
Try this code...It worked for me. ->Another way to load pickle data ->Once check your pickle format where you write and read pickle data ->It should be .pkl or .pickle but should be same at both places
— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.
Hello! Thank you very much for your sharing!But one of my problems is that I don't know how to save the images in the data set as pickle files.How do you solve this problem?Can you give me some Pointers?Thank you very much! … ------------------ 原始邮件 ------------------ 发件人: "I-Hope-Peace/DSMSCN" @.>; 发送时间: 2021年3月12日(星期五) 上午7:38 @.>; @.**@.>; 主题: Re: [I-Hope-Peace/DSMSCN] "train_sample_1.pickle" in code (#3) def load_test_data(): file = open("data/Szada/test_sample_1.pickle", "rb") test_X = pickle.load(file) file.close() file = open("data/Szada/test_sample_2.pickle", "rb") test_Y = pickle.load(file) file.close() file = open("data/Szada/test_label.pickle", "rb") test_label = pickle.load(file) file.close() return test_X, test_Y, test_label Try this code...It worked for me. ->Another way to load pickle data ->Once check your pickle format where you write and read pickle data ->It should be .pkl or .pickle but should be same at both places — You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.
There are two ways to save pickle data
=>1st:
def read_data():
path = 'data/Szada/train'
test_img_1 = []
test_img_2 = []
test_label = []
file_names = sorted(os.listdir(path))
for file_name in file_names:
if file_name[-4:].upper() == '.BMP':
img = cv.imread(os.path.join(path, file_name))
if img.shape[0] > img.shape[1]:
img = img[0:784, :, :]
elif img.shape[0] < img.shape[1]:
img = img[:, 0:784, :]
if 'gt.bmp' in file_name.lower():
img = cv.cvtColor(img, cv.COLOR_RGB2GRAY)
train_label.append(img)
elif 'im1.bmp' in file_name.lower():
train_img_1.append(img)
elif 'im2.bmp' in file_name.lower():
train_img_2.append(img)
file = open("data/Szada/train_sample_1.pickle", "wb")
pickle.dump(train_img_1, file)
file.close()
file = open("data/Szada/train_sample_2.pickle", "wb")
pickle.dump(train_img_2, file)
file.close()
file = open("data/Szada/train_label.pickle", "wb")
pickle.dump(train_label, file)
file.close()
return train_img_1, train_img_2, train_label
=>2nd:
def read_data(): path = 'data/Szada/train' train_img_1 = [] train_img_2 = [] train_label = [] file_names = sorted(os.listdir(path)) for file_name in file_names: if file_name[-4:].upper() == '.BMP': img = cv.imread(os.path.join(path, file_name)) if img.shape[0] > img.shape[1]: img = img[0:784, :, :] elif img.shape[0] < img.shape[1]: img = img[:, 0:784, :] if 'gt.bmp' in file_name.lower(): img = cv.cvtColor(img, cv.COLOR_RGB2GRAY) train_label.append(img) elif 'im1.bmp' in file_name.lower(): train_img_1.append(img) elif 'im2.bmp' in file_name.lower(): train_img_2.append(img) with open('data/Szada/train_sample_1.pickle', 'wb') as file: pickle.dump(train_img_1, file) print(train_img_1) with open('data/Szada/train_sample_2.pickle', 'wb') as file: pickle.dump(train_img_2, file) with open('data/Szada/train_label.pickle', 'wb') as file: pickle.dump(train_label, file) return train_img_1, train_img_2, train_label
steps=> 1 create a folder name data/Szada 2 give path to data set which you are taking for modeling 3 define these function 4 call these function by ----> read_data() or xm,ym,zm=read_data1() where xm,ym,zm are three pickle files to visualize 5 check in folder there should be pickle files
Note: Dont forget to import pickle
Hope this will solve your issue!!!!
Hi Authors, I'm getting the following error when running 'train_my_model' file., 'No such file or directory: 'data/ACD/Szada/train_sample_1.pickle'' I noticed that in your code there is a load_train_data and load_test data function.
Could you please help with that? Thanks a lot.