from LIBS.DLP.my_predict_helper import do_predict DO_PREPROCESS = False GEN_CSV = True COMPUTE_DIR_FILES = True dir_original = '/media/ubuntu/data1/screen/original' dir_preprocess = '/media/ubuntu/data1/screen/preprocess384/' dir_dest = '/media/ubuntu/data1/ROP项目/screen/results/LaserSpot' pkl_prob = os.path.join(dir_dest, 'probs.pkl') from LIBS.ImgPreprocess import my_preprocess_dir if DO_PREPROCESS: my_preprocess_dir.do_preprocess_dir(dir_original, dir_preprocess, image_size=384, is_rop=False, add_black_pixel_ratio=0.07) dicts_models = [] model_dir = '/tmp5/models_2020_6_19/DR_english/v1' dict_model1 = { 'model_file': os.path.join(model_dir, 'InceptionV3-004-0.982.hdf5'), 'input_shape': (299, 299, 3), 'model_weight': 1 } dicts_models.append(dict_model1) dict_model1 = { 'model_file': os.path.join(model_dir, 'InceptionResnetV2-004-0.984.hdf5'), 'input_shape': (299, 299, 3), 'model_weight': 1
from LIBS.Generator import my_images_generator_2d from LIBS.Neural_Networks.Heatmaps.CAM import my_helper_cam, my_helper_grad_cam, my_helper_grad_cam_plusplus from tensorflow import keras DO_PREPROCESS = False GEN_CSV = True DIR_ORIGINAL = '/media/ubuntu/data1/糖网项目/DR分级英国标准_20190119_无杂病/DR/original' DIR_PREPROCESS = '/media/ubuntu/data1/糖网项目/DR分级英国标准_20190119_无杂病/DR/preprocess384/' DIR_DEST = '/media/ubuntu/data1/糖网项目/DR分级英国标准_20190119_无杂病/DR/results/CAM/' from LIBS.ImgPreprocess import my_preprocess_dir if DO_PREPROCESS: my_preprocess_dir.do_preprocess_dir(DIR_ORIGINAL, DIR_PREPROCESS, image_size=384, is_rop=False, add_black_pixel_ratio=0.07) filename_csv = os.path.join(DIR_DEST, 'csv', 'predict_dir.csv') if GEN_CSV: os.makedirs(os.path.dirname(filename_csv), exist_ok=True) from LIBS.DataPreprocess.my_data import write_csv_dir_nolabel write_csv_dir_nolabel(filename_csv, DIR_PREPROCESS) #region load and convert models model_dir = '/tmp5/models_2020_6_19/DR_english/v1' dicts_models = [] dict_model1 = { 'model_file': os.path.join(model_dir, 'InceptionResnetV2-004-0.984.hdf5'),