luna.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:lung-cancer-detector 作者: YichenGong 项目源码 文件源码
def _pre_process_all(self):
        if self._pre_processed_exists():
            self._load_norm_parameters()
            print("Mean = ", self._mean, ", STD = ", self._std)
            return

        print("No pre-processed dataset found, pre-processing now...")
        if not(os.path.exists(self._target_directory)):
            os.makedirs(self._target_directory)

        size = len(self._all_series)
        for idx, patient in enumerate(self._all_series):
            print(patient[1], str(idx+1) + "/" + str(size))
            p.dump(self._pre_process(patient), open(os.path.join(self._target_directory, patient[1] + ".pick"), "wb"), protocol=2)

        print("Mean = ", self._mean, ", STD = ", self._std)
        p.dump((self._mean, self._std), open(os.path.join(self._target_directory, "norm_parameters.pick"), "wb"), protocol=2)

        print("Pre-processing Done!")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号