Пример #1
0
	def prepare_dataset(self):

		# 训练图片汇成HDF5合集 preapare train_img/groundtruth.hdf5
		imgs_train, groundTruth=self._access_dataset(self.train_img_path,self.train_groundtruth_path,self.train_type)
		write_hdf5(imgs_train,self.hdf5_path+"/train_img.hdf5")
		write_hdf5(groundTruth, self.hdf5_path+"/train_groundtruth.hdf5")
		print("[INFO] Saving Training Data")
		# 测试图片汇成HDF5合集 preapare val_img/groundtruth.hdf5
		imgs_val, groundTruth = self._access_dataset(self.val_img_path, self.val_groundtruth_path, self.val_type)
		write_hdf5(imgs_val, self.hdf5_path + "/val_img.hdf5")
		write_hdf5(groundTruth, self.hdf5_path + "/val_groundtruth.hdf5")
		print("[INFO] Saving Validation Data")
    def prepare_dataset(self):

        # 训练图片汇成HDF5合集 preapare train_img/groundtruth.hdf5
        imgs_train, groundTruth = self._access_dataset(
            "C:\\Users\\kk\\Desktop\\Optic-Disc-Unet-master-Braits\\Optic-Disc-Unet-master\\Optic-Disc-Unet-master\\experiments\\OpticDisc\\dataset\\train\\origin",
            "C:\\Users\\kk\\Desktop\\Optic-Disc-Unet-master-Braits\\Optic-Disc-Unet-master\\Optic-Disc-Unet-master\\experiments\\OpticDisc\\dataset\\train\\groundtruth",
            self.train_type)
        write_hdf5(imgs_train, self.hdf5_path + "/train_img.hdf5")
        write_hdf5(groundTruth, self.hdf5_path + "/train_groundtruth.hdf5")
        print("[INFO] Saving Training Data")
        # 测试图片汇成HDF5合集 preapare val_img/groundtruth.hdf5
        imgs_val, groundTruth = self._access_dataset(
            "C:\\Users\\kk\\Desktop\\Optic-Disc-Unet-master-Braits\\Optic-Disc-Unet-master\\Optic-Disc-Unet-master\\experiments\\OpticDisc\\dataset\\validate\\origin",
            "C:\\Users\\kk\\Desktop\\Optic-Disc-Unet-master-Braits\\Optic-Disc-Unet-master\\Optic-Disc-Unet-master\\experiments\\OpticDisc\\dataset\\validate\\groundtruth",
            self.val_type)
        write_hdf5(imgs_val, self.hdf5_path + "/val_img.hdf5")
        write_hdf5(groundTruth, self.hdf5_path + "/val_groundtruth.hdf5")
        print("[INFO] Saving Validation Data")
	def prepare_dataset(self):
		if self.dataset == 'CHASEDB1':
		    print('Writing CHASEDB1....')
		    imgs_train, train_groundTruth=self._accesee_dataset_CHASEDB1(self.train_img_path)
		    imgs_val, val_groundTruth = self._accesee_dataset_CHASEDB1(self.val_img_path)
		elif self.dataset == 'DRIVE':
		    print('Writing DRIVE....')
		    imgs_train, train_groundTruth=self._access_dataset(self.train_img_path,self.train_groundtruth_path,self.train_type,'train')
		    imgs_val, val_groundTruth = self._access_dataset(self.val_img_path,self.val_groundtruth_path,self.val_type,'val')
		
		elif self.dataset == 'DRIVE_MULTICLASS':
		    print('Writing DRIVE_MULTICALSS....')
		    imgs_train, train_groundTruth=self._access_multiclass_dataset(self.train_img_path,self.train_groundtruth_path,self.train_type,'train')
		    imgs_val, val_groundTruth = self._access_multiclass_dataset(self.val_img_path,self.val_groundtruth_path,self.val_type,'val')

		elif self.dataset == 'STARE':
		    print('Writing STARE....')
		    imgs_train, train_groundTruth=self._access_STARE_dataset(self.train_img_path,self.train_groundtruth_path,self.train_type,'train')
		    imgs_val, val_groundTruth = self._access_STARE_dataset(self.val_img_path,self.val_groundtruth_path,self.val_type,'val')
		elif self.dataset=='CROSS':
		    imgs_train, train_groundTruth=self._access_dataset(self.train_img_path,self.train_groundtruth_path,self.train_type,'train')
		    imgs_val, val_groundTruth = self._accesee_dataset_CHASEDB1(self.val_img_path)
		elif self.dataset == 'HRF':
		    imgs_train, train_groundTruth=self._access_HRF_dataset(self.train_img_path,self.train_groundtruth_path,self.train_type,'train')
		    imgs_val, val_groundTruth = self._access_HRF_dataset(self.val_img_path,self.val_groundtruth_path,self.val_type,'val')

		elif self.dataset == 'prob':
		    imgs_train, train_groundTruth=self._access_dataset(self.train_img_path,self.train_groundtruth_path,self.train_type,'train')
		    imgs_val, val_groundTruth = self._access_dataset(self.val_img_path,self.val_groundtruth_path,self.val_type,'val')
		    probs_train = self._access_prob_dataset(self.train_img_path,self.train_groundtruth_path,self.prob_path,self.val_type,'prob')
		    probs_val = self._access_prob_dataset(self.val_img_path,self.val_groundtruth_path,self.prob_val_path,self.val_type,'val_prob')
          
#		    imgs_train, train_groundTruth=self._accesee_dataset_CHASEDB1(self.train_img_path)
#		    imgs_val, val_groundTruth = self._access_dataset(self.val_img_path,self.val_groundtruth_path,self.val_type,'val')
            
		write_hdf5(imgs_train,self.hdf5_path+"/_"+self.dataset+"_train_img.hdf5")
		write_hdf5(train_groundTruth, self.hdf5_path+"/_"+self.dataset+"_train_groundtruth.hdf5")
		print("[INFO] Saving Training Data")
		# 测试图片汇成HDF5合集 preapare val_img/groundtruth.hdf5
#		    imgs_val, groundTruth = self._accesee_dataset_CHASEDB1(self.val_img_path)
		write_hdf5(imgs_val, self.hdf5_path + "/_"+self.dataset+"_val_img.hdf5")
		write_hdf5(val_groundTruth, self.hdf5_path + "/_"+self.dataset+"_val_groundtruth.hdf5")
		print("[INFO] Saving Validation Data")
        
		if self.dataset =='prob':
		    write_hdf5(probs_val,self.hdf5_path+"/_"+self.dataset+"_prob_val_img.hdf5")
            
		    write_hdf5(probs_train,self.hdf5_path+"/_"+self.dataset+"_prob_img.hdf5")
#		write_hdf5(train_groundTruth, self.hdf5_path+"/_"+self.dataset+"_train_groundtruth.hdf5")
		    print("[INFO] Saving prob Data")