Python keras.utils.data_utils.get_file() Examples
The following are 30
code examples of keras.utils.data_utils.get_file().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
keras.utils.data_utils
, or try the search function
.
Example #1
Source File: imagenet_utils.py From deep-learning-models with MIT License | 6 votes |
def decode_predictions(preds, top=5): global CLASS_INDEX if len(preds.shape) != 2 or preds.shape[1] != 1000: raise ValueError('`decode_predictions` expects ' 'a batch of predictions ' '(i.e. a 2D array of shape (samples, 1000)). ' 'Found array with shape: ' + str(preds.shape)) if CLASS_INDEX is None: fpath = get_file('imagenet_class_index.json', CLASS_INDEX_PATH, cache_subdir='models') CLASS_INDEX = json.load(open(fpath)) results = [] for pred in preds: top_indices = pred.argsort()[-top:][::-1] result = [tuple(CLASS_INDEX[str(i)]) + (pred[i],) for i in top_indices] results.append(result) return results
Example #2
Source File: annothelper.py From deephar with MIT License | 6 votes |
def check_pennaction_dataset(): version = 'v0.3' try: penn_path = os.path.join(os.getcwd(), 'datasets/PennAction/') annot_path = get_file(penn_path + 'annotations.mat', ORIGIN + version + '/penn_annotations.mat', md5_hash='b37a2e72c0ba308bd7ad476bc2aa4d33') bbox_path = get_file(penn_path + 'penn_pred_bboxes_16f.json', ORIGIN + version + '/penn_pred_bboxes_16f.json', md5_hash='30b124a919185cb031b928bc6154fa9b') if os.path.isdir(penn_path + 'frames') is False: raise Exception('PennAction dataset (frames) not found! ' 'You must download it by yourself from ' 'http://dreamdragon.github.io/PennAction') except: sys.stderr.write('Error checking PennAction dataset!\n') raise
Example #3
Source File: annothelper.py From deephar with MIT License | 6 votes |
def check_h36m_dataset(): version = 'v0.2' try: h36m_path = os.path.join(os.getcwd(), 'datasets/Human3.6M/') annot_path = get_file(h36m_path + 'annotations.mat', ORIGIN + version + '/h36m_annotations.mat', md5_hash='4067d52db61737fbebdec850238d87dd') if os.path.isdir(h36m_path + 'images') is False: raise Exception('Human3.6M dataset (images) not found! ' 'You must download it by yourself from ' 'http://vision.imar.ro/human3.6m ' 'and extract the video files!') except: sys.stderr.write('Error checking Human3.6M dataset!\n') raise
Example #4
Source File: imagenet_utils.py From Image-Captioning with MIT License | 6 votes |
def decode_imagenet_predictions(preds, top=5): global CLASS_INDEX if len(preds.shape) != 2 or preds.shape[1] != 1000: raise ValueError('`decode_predictions` expects ' 'a batch of predictions ' '(i.e. a 2D array of shape (samples, 1000)). ' 'Found array with shape: ' + str(preds.shape)) if CLASS_INDEX is None: fpath = get_file('imagenet_class_index.json', CLASS_INDEX_PATH, cache_subdir='models') CLASS_INDEX = json.load(open(fpath)) results = [] for pred in preds: top_indices = pred.argsort()[-top:][::-1] result = [tuple(CLASS_INDEX[str(i)]) + (pred[i],) for i in top_indices] results.append(result) return results
Example #5
Source File: annothelper.py From deephar with MIT License | 6 votes |
def check_mpii_dataset(): version = 'v0.1' try: mpii_path = os.path.join(os.getcwd(), 'datasets/MPII/') annot_path = get_file(mpii_path + 'annotations.mat', ORIGIN + version + '/mpii_annotations.mat', md5_hash='cc62b1bb855bf4866d19bc0637526930') if os.path.isdir(mpii_path + 'images') is False: raise Exception('MPII dataset (images) not found! ' 'You must download it by yourself from ' 'http://human-pose.mpi-inf.mpg.de') except: sys.stderr.write('Error checking MPII dataset!\n') raise
Example #6
Source File: get_weights_path.py From Keras-FCN with MIT License | 5 votes |
def get_weights_path_resnet(): TF_WEIGHTS_PATH = 'https://github.com/fchollet/deep-learning-models/releases/download/v0.2/resnet50_weights_tf_dim_ordering_tf_kernels.h5' weights_path = get_file('resnet50_weights_tf_dim_ordering_tf_kernels.h5',TF_WEIGHTS_PATH,cache_subdir='models') return weights_path
Example #7
Source File: embeddings.py From keras-text with MIT License | 5 votes |
def get_embeddings_index(embedding_type='glove.42B.300d'): """Retrieves embeddings index from embedding name. Will automatically download and cache as needed. Args: embedding_type: The embedding type to load. Returns: The embeddings indexed by word. """ embeddings_index = _EMBEDDINGS_CACHE.get(embedding_type) if embeddings_index is not None: return embeddings_index data_obj = _EMBEDDING_TYPES.get(embedding_type) if data_obj is None: raise ValueError("Embedding name should be one of '{}'".format(_EMBEDDING_TYPES.keys())) cache_dir = os.path.expanduser(os.path.join('~', '.keras-text')) if not os.path.exists(cache_dir): os.makedirs(cache_dir) file_path = get_file(embedding_type, origin=data_obj['url'], extract=True, cache_dir=cache_dir, cache_subdir='embeddings') file_path = os.path.join(os.path.dirname(file_path), data_obj['file']) embeddings_index = _build_embeddings_index(file_path) _EMBEDDINGS_CACHE[embedding_type] = embeddings_index return embeddings_index
Example #8
Source File: model.py From cvpr-2018-autonomous-driving-autopilot-solution with MIT License | 5 votes |
def get_imagenet_weights(self): """Downloads ImageNet trained weights from Keras. Returns path to weights file. """ from keras.utils.data_utils import get_file TF_WEIGHTS_PATH_NO_TOP = 'https://github.com/fchollet/deep-learning-models/'\ 'releases/download/v0.2/'\ 'resnet50_weights_tf_dim_ordering_tf_kernels_notop.h5' weights_path = get_file('resnet50_weights_tf_dim_ordering_tf_kernels_notop.h5', TF_WEIGHTS_PATH_NO_TOP, cache_subdir='models', md5_hash='a268eb855778b3df3c7506639542a6af') return weights_path
Example #9
Source File: model_inceptionresnet.py From cvpr-2018-autonomous-driving-autopilot-solution with MIT License | 5 votes |
def get_imagenet_weights(self): """Downloads ImageNet trained weights from Keras. Returns path to weights file. """ from keras.utils.data_utils import get_file TF_WEIGHTS_PATH_NO_TOP = 'https://github.com/fchollet/deep-learning-models/'\ 'releases/download/v0.2/'\ 'resnet50_weights_tf_dim_ordering_tf_kernels_notop.h5' weights_path = get_file('resnet50_weights_tf_dim_ordering_tf_kernels_notop.h5', TF_WEIGHTS_PATH_NO_TOP, cache_subdir='models', md5_hash='a268eb855778b3df3c7506639542a6af') return weights_path
Example #10
Source File: utils.py From keras-vggface with MIT License | 5 votes |
def decode_predictions(preds, top=5): LABELS = None if len(preds.shape) == 2: if preds.shape[1] == 2622: fpath = get_file('rcmalli_vggface_labels_v1.npy', V1_LABELS_PATH, cache_subdir=VGGFACE_DIR) LABELS = np.load(fpath) elif preds.shape[1] == 8631: fpath = get_file('rcmalli_vggface_labels_v2.npy', V2_LABELS_PATH, cache_subdir=VGGFACE_DIR) LABELS = np.load(fpath) else: raise ValueError('`decode_predictions` expects ' 'a batch of predictions ' '(i.e. a 2D array of shape (samples, 2622)) for V1 or ' '(samples, 8631) for V2.' 'Found array with shape: ' + str(preds.shape)) else: raise ValueError('`decode_predictions` expects ' 'a batch of predictions ' '(i.e. a 2D array of shape (samples, 2622)) for V1 or ' '(samples, 8631) for V2.' 'Found array with shape: ' + str(preds.shape)) results = [] for pred in preds: top_indices = pred.argsort()[-top:][::-1] result = [[str(LABELS[i].encode('utf8')), pred[i]] for i in top_indices] result.sort(key=lambda x: x[1], reverse=True) results.append(result) return results
Example #11
Source File: utils.py From EmotionClassifier with GNU General Public License v3.0 | 5 votes |
def decode_predictions(preds, top=5): LABELS = None if len(preds.shape) == 2: if preds.shape[1] == 2622: fpath = get_file('rcmalli_vggface_labels_v1.npy', V1_LABELS_PATH, cache_subdir=VGGFACE_DIR, cache_dir='./') LABELS = np.load(fpath) elif preds.shape[1] == 8631: fpath = get_file('rcmalli_vggface_labels_v2.npy', V2_LABELS_PATH, cache_subdir=VGGFACE_DIR, cache_dir='./') LABELS = np.load(fpath) else: raise ValueError('`decode_predictions` expects ' 'a batch of predictions ' '(i.e. a 2D array of shape (samples, 2622)) for V1 or ' '(samples, 8631) for V2.' 'Found array with shape: ' + str(preds.shape)) else: raise ValueError('`decode_predictions` expects ' 'a batch of predictions ' '(i.e. a 2D array of shape (samples, 2622)) for V1 or ' '(samples, 8631) for V2.' 'Found array with shape: ' + str(preds.shape)) results = [] for pred in preds: top_indices = pred.argsort()[-top:][::-1] result = [[str(LABELS[i].encode('utf8')), pred[i]] for i in top_indices] result.sort(key=lambda x: x[1], reverse=True) results.append(result) return results
Example #12
Source File: get_weights_path.py From Keras-FCN with MIT License | 5 votes |
def get_weights_path_vgg16(): TF_WEIGHTS_PATH = 'https://github.com/fchollet/deep-learning-models/releases/download/v0.1/vgg16_weights_tf_dim_ordering_tf_kernels.h5' weights_path = get_file('vgg16_weights_tf_dim_ordering_tf_kernels.h5',TF_WEIGHTS_PATH,cache_subdir='models') return weights_path
Example #13
Source File: pcam.py From pcam with MIT License | 5 votes |
def load_data(): """Loads PCam dataset. # Returns Tuple of Numpy arrays: `(x_train, y_train), (x_test, y_test)`. """ dirname = os.path.join('datasets', 'pcam') base = 'https://drive.google.com/uc?export=download&id=' try: y_train = HDF5Matrix(get_file('camelyonpatch_level_2_split_train_y.h5', origin= base+ '1269yhu3pZDP8UYFQs-NYs3FPwuK-nGSG', cache_subdir=dirname, archive_format='gzip'), 'y') x_valid = HDF5Matrix(get_file('camelyonpatch_level_2_split_valid_x.h5', origin= base+ '1hgshYGWK8V-eGRy8LToWJJgDU_rXWVJ3', cache_subdir=dirname, archive_format='gzip'), 'x') y_valid = HDF5Matrix(get_file('camelyonpatch_level_2_split_valid_y.h5', origin= base+ '1bH8ZRbhSVAhScTS0p9-ZzGnX91cHT3uO', cache_subdir=dirname, archive_format='gzip'), 'y') x_test = HDF5Matrix(get_file('camelyonpatch_level_2_split_test_x.h5', origin= base+ '1qV65ZqZvWzuIVthK8eVDhIwrbnsJdbg_', cache_subdir=dirname, archive_format='gzip'), 'x') y_test = HDF5Matrix(get_file('camelyonpatch_level_2_split_test_y.h5', origin= base+ '17BHrSrwWKjYsOgTMmoqrIjDy6Fa2o_gP', cache_subdir=dirname, archive_format='gzip'), 'y') meta_train = pd.read_csv(get_file('camelyonpatch_level_2_split_train_meta.csv', origin= base+ '1XoaGG3ek26YLFvGzmkKeOz54INW0fruR', cache_subdir=dirname)) meta_valid = pd.read_csv(get_file('camelyonpatch_level_2_split_valid_meta.csv', origin= base+ '16hJfGFCZEcvR3lr38v3XCaD5iH1Bnclg', cache_subdir=dirname)) meta_test = pd.read_csv(get_file('camelyonpatch_level_2_split_test_meta.csv', origin= base+ '19tj7fBlQQrd4DapCjhZrom_fA4QlHqN4', cache_subdir=dirname)) x_train = HDF5Matrix(get_file('camelyonpatch_level_2_split_train_x.h5', origin= base+ '1Ka0XfEMiwgCYPdTI-vv6eUElOBnKFKQ2', cache_subdir=dirname, archive_format='gzip'), 'x') except OSError: raise NotImplementedError('Direct download currently not working. Please go to https://drive.google.com/drive/folders/1gHou49cA1s5vua2V5L98Lt8TiWA3FrKB and press download all. Then place files (ungzipped) in ~/.keras/datasets/pcam.') if K.image_data_format() == 'channels_first': raise NotImplementedError() return (x_train, y_train, meta_train), (x_valid, y_valid, meta_valid), (x_test, y_test, meta_test)
Example #14
Source File: model.py From PanopticSegmentation with MIT License | 5 votes |
def get_imagenet_weights(self): """Downloads ImageNet trained weights from Keras. Returns path to weights file. """ from keras.utils.data_utils import get_file TF_WEIGHTS_PATH_NO_TOP = 'https://github.com/fchollet/deep-learning-models/'\ 'releases/download/v0.2/'\ 'resnet50_weights_tf_dim_ordering_tf_kernels_notop.h5' weights_path = get_file('resnet50_weights_tf_dim_ordering_tf_kernels_notop.h5', TF_WEIGHTS_PATH_NO_TOP, cache_subdir='models', md5_hash='a268eb855778b3df3c7506639542a6af') return weights_path
Example #15
Source File: model.py From ocrd_anybaseocr with Apache License 2.0 | 5 votes |
def get_imagenet_weights(self): """Downloads ImageNet trained weights from Keras. Returns path to weights file. """ from keras.utils.data_utils import get_file TF_WEIGHTS_PATH_NO_TOP = 'https://github.com/fchollet/deep-learning-models/'\ 'releases/download/v0.2/'\ 'resnet50_weights_tf_dim_ordering_tf_kernels_notop.h5' weights_path = get_file('resnet50_weights_tf_dim_ordering_tf_kernels_notop.h5', TF_WEIGHTS_PATH_NO_TOP, cache_subdir='models', md5_hash='a268eb855778b3df3c7506639542a6af') return weights_path
Example #16
Source File: pcam.py From pcam with MIT License | 5 votes |
def get_unzip_file(fname, origin, untar=False, md5_hash=None, file_hash=None, cache_subdir='datasets', hash_algorithm='auto', extract=False, archive_format='auto', cache_dir=None): import gzip import shutil get_file() with open('file.txt', 'rb') as f_in, gzip.open('file.txt.gz', 'wb') as f_out: shutil.copyfileobj(f_in, f_out)
Example #17
Source File: volumes.py From diluvian with MIT License | 5 votes |
def from_toml(filename): from keras.utils.data_utils import get_file volumes = {} with open(filename, 'rb') as fin: datasets = toml.load(fin).get('dataset', []) for dataset in datasets: hdf5_file = dataset['hdf5_file'] if dataset.get('use_keras_cache', False): hdf5_file = get_file(hdf5_file, dataset['download_url'], md5_hash=dataset.get('download_md5', None)) image_dataset = dataset.get('image_dataset', None) label_dataset = dataset.get('label_dataset', None) mask_dataset = dataset.get('mask_dataset', None) mask_bounds = dataset.get('mask_bounds', None) resolution = dataset.get('resolution', None) hdf5_pathed_file = os.path.join(os.path.dirname(filename), hdf5_file) volume = HDF5Volume(hdf5_pathed_file, image_dataset, label_dataset, mask_dataset, mask_bounds=mask_bounds) # If the volume configuration specifies an explicit resolution, # override any provided in the HDF5 itself. if resolution: logging.info('Overriding resolution for volume "%s"', dataset['name']) volume.resolution = np.array(resolution) volumes[dataset['name']] = volume return volumes
Example #18
Source File: model.py From latte with Apache License 2.0 | 5 votes |
def get_imagenet_weights(self): """Downloads ImageNet trained weights from Keras. Returns path to weights file. """ from keras.utils.data_utils import get_file TF_WEIGHTS_PATH_NO_TOP = 'https://github.com/fchollet/deep-learning-models/'\ 'releases/download/v0.2/'\ 'resnet50_weights_tf_dim_ordering_tf_kernels_notop.h5' weights_path = get_file('resnet50_weights_tf_dim_ordering_tf_kernels_notop.h5', TF_WEIGHTS_PATH_NO_TOP, cache_subdir='models', md5_hash='a268eb855778b3df3c7506639542a6af') return weights_path
Example #19
Source File: model.py From SketchyScene with MIT License | 5 votes |
def get_imagenet_weights(self): """Downloads ImageNet trained weights from Keras. Returns path to weights file. """ from keras.utils.data_utils import get_file TF_WEIGHTS_PATH_NO_TOP = 'https://github.com/fchollet/deep-learning-models/'\ 'releases/download/v0.2/'\ 'resnet50_weights_tf_dim_ordering_tf_kernels_notop.h5' weights_path = get_file('resnet50_weights_tf_dim_ordering_tf_kernels_notop.h5', TF_WEIGHTS_PATH_NO_TOP, cache_subdir='models', md5_hash='a268eb855778b3df3c7506639542a6af') return weights_path
Example #20
Source File: model.py From PyTorch-Luna16 with Apache License 2.0 | 5 votes |
def get_imagenet_weights(self): """Downloads ImageNet trained weights from Keras. Returns path to weights file. """ from keras.utils.data_utils import get_file TF_WEIGHTS_PATH_NO_TOP = 'https://github.com/fchollet/deep-learning-models/'\ 'releases/download/v0.2/'\ 'resnet50_weights_tf_dim_ordering_tf_kernels_notop.h5' weights_path = get_file('resnet50_weights_tf_dim_ordering_tf_kernels_notop.h5', TF_WEIGHTS_PATH_NO_TOP, cache_subdir='models', md5_hash='a268eb855778b3df3c7506639542a6af') return weights_path
Example #21
Source File: imagenet_utils.py From ActionRecognition with MIT License | 5 votes |
def decode_predictions(preds, top=5): """Decodes the prediction of an ImageNet model. # Arguments preds: Numpy tensor encoding a batch of predictions. top: integer, how many top-guesses to return. # Returns A list of lists of top class prediction tuples `(class_name, class_description, score)`. One list of tuples per sample in batch input. # Raises ValueError: in case of invalid shape of the `pred` array (must be 2D). """ global CLASS_INDEX if len(preds.shape) != 2 or preds.shape[1] != 1000: raise ValueError('`decode_predictions` expects ' 'a batch of predictions ' '(i.e. a 2D array of shape (samples, 1000)). ' 'Found array with shape: ' + str(preds.shape)) if CLASS_INDEX is None: fpath = get_file('imagenet_class_index.json', CLASS_INDEX_PATH, cache_subdir='models') CLASS_INDEX = json.load(open(fpath)) results = [] for pred in preds: top_indices = pred.argsort()[-top:][::-1] result = [tuple(CLASS_INDEX[str(i)]) + (pred[i],) for i in top_indices] result.sort(key=lambda x: x[2], reverse=True) results.append(result) return results
Example #22
Source File: imagenet_utils.py From ActionRecognition with MIT License | 5 votes |
def decode_predictions(preds, top=5): """Decodes the prediction of an ImageNet model. # Arguments preds: Numpy tensor encoding a batch of predictions. top: integer, how many top-guesses to return. # Returns A list of lists of top class prediction tuples `(class_name, class_description, score)`. One list of tuples per sample in batch input. # Raises ValueError: in case of invalid shape of the `pred` array (must be 2D). """ global CLASS_INDEX if len(preds.shape) != 2 or preds.shape[1] != 1000: raise ValueError('`decode_predictions` expects ' 'a batch of predictions ' '(i.e. a 2D array of shape (samples, 1000)). ' 'Found array with shape: ' + str(preds.shape)) if CLASS_INDEX is None: fpath = get_file('imagenet_class_index.json', CLASS_INDEX_PATH, cache_subdir='models') CLASS_INDEX = json.load(open(fpath)) results = [] for pred in preds: top_indices = pred.argsort()[-top:][::-1] result = [tuple(CLASS_INDEX[str(i)]) + (pred[i],) for i in top_indices] result.sort(key=lambda x: x[2], reverse=True) results.append(result) return results
Example #23
Source File: BaseModel.py From Keras-RFCN with MIT License | 5 votes |
def get_imagenet_weights(self): """Downloads ImageNet trained weights from Keras. Returns path to weights file. """ from keras.utils.data_utils import get_file TF_WEIGHTS_PATH_NO_TOP = 'https://github.com/fchollet/deep-learning-models/'\ 'releases/download/v0.2/'\ 'resnet50_weights_tf_dim_ordering_tf_kernels_notop.h5' weights_path = get_file('resnet50_weights_tf_dim_ordering_tf_kernels_notop.h5', TF_WEIGHTS_PATH_NO_TOP, cache_subdir='models', md5_hash='a268eb855778b3df3c7506639542a6af') return weights_path
Example #24
Source File: facades_dataset.py From pix2pix-keras with MIT License | 5 votes |
def download_facades_bw(tmp_path, data_folder_path): # download to .tmp file downloaded_path = get_file(tmp_path + '/facades_bw.tar', origin=AWS_FACADES_PATH) # un-tar untar_file(downloaded_path, data_folder_path + '/facades_bw', remove_tar=False, flags='-xvf') # move data file subprocess.call(['rm', '-rf', tmp_path])
Example #25
Source File: webcan.py From pose-regression with MIT License | 5 votes |
def main_thread(): # Build the model and load the pre-trained weights on MPII model = posereg.build(input_shape, pa16j.num_joints, export_heatmaps=True) weights_path = get_file(weights_file, TF_WEIGHTS_PATH, md5_hash=md5_hash, cache_subdir=cache_subdir) model.load_weights(weights_path) queue_frames = queue.Queue(2) queue_poses = queue.Queue(2) proc = threading.Thread(target=thread_grab_frames, args=(queue_frames, queue_poses)) proc.daemon = True proc.start() clock = pygame.time.Clock() show_fps_cnt = 0 while True: x = queue_frames.get() pred = model.predict(x) pred.append(x) # Append the input frame queue_poses.put(pred) clock.tick() show_fps_cnt += 1 if show_fps_cnt == 10: show_fps_cnt = 0 print ('fps: ' + str(clock.get_fps()))
Example #26
Source File: model.py From deepdiy with MIT License | 5 votes |
def get_imagenet_weights(self): """Downloads ImageNet trained weights from Keras. Returns path to weights file. """ from keras.utils.data_utils import get_file TF_WEIGHTS_PATH_NO_TOP = 'https://github.com/fchollet/deep-learning-models/'\ 'releases/download/v0.2/'\ 'resnet50_weights_tf_dim_ordering_tf_kernels_notop.h5' weights_path = get_file('resnet50_weights_tf_dim_ordering_tf_kernels_notop.h5', TF_WEIGHTS_PATH_NO_TOP, cache_subdir='models', md5_hash='a268eb855778b3df3c7506639542a6af') return weights_path
Example #27
Source File: model.py From Skin-Cancer-Segmentation with MIT License | 5 votes |
def get_imagenet_weights(self): """Downloads ImageNet trained weights from Keras. Returns path to weights file. """ from keras.utils.data_utils import get_file TF_WEIGHTS_PATH_NO_TOP = 'https://github.com/fchollet/deep-learning-models/'\ 'releases/download/v0.2/'\ 'resnet50_weights_tf_dim_ordering_tf_kernels_notop.h5' weights_path = get_file('resnet50_weights_tf_dim_ordering_tf_kernels_notop.h5', TF_WEIGHTS_PATH_NO_TOP, cache_subdir='models', md5_hash='a268eb855778b3df3c7506639542a6af') return weights_path
Example #28
Source File: model.py From SpaceNet_Off_Nadir_Solutions with Apache License 2.0 | 5 votes |
def get_imagenet_weights(self): """Downloads ImageNet trained weights from Keras. Returns path to weights file. """ from keras.utils.data_utils import get_file TF_WEIGHTS_PATH_NO_TOP = 'https://github.com/fchollet/deep-learning-models/'\ 'releases/download/v0.2/'\ 'resnet50_weights_tf_dim_ordering_tf_kernels_notop.h5' weights_path = get_file('resnet50_weights_tf_dim_ordering_tf_kernels_notop.h5', TF_WEIGHTS_PATH_NO_TOP, cache_subdir='models', md5_hash='a268eb855778b3df3c7506639542a6af') return weights_path
Example #29
Source File: model_mod_mpan.py From SpaceNet_Off_Nadir_Solutions with Apache License 2.0 | 5 votes |
def get_imagenet_weights(self): """Downloads ImageNet trained weights from Keras. Returns path to weights file. """ from keras.utils.data_utils import get_file TF_WEIGHTS_PATH_NO_TOP = 'https://github.com/fchollet/deep-learning-models/'\ 'releases/download/v0.2/'\ 'resnet50_weights_tf_dim_ordering_tf_kernels_notop.h5' weights_path = get_file('resnet50_weights_tf_dim_ordering_tf_kernels_notop.h5', TF_WEIGHTS_PATH_NO_TOP, cache_subdir='models', md5_hash='a268eb855778b3df3c7506639542a6af') return weights_path
Example #30
Source File: model_mod_rgb.py From SpaceNet_Off_Nadir_Solutions with Apache License 2.0 | 5 votes |
def get_imagenet_weights(self): """Downloads ImageNet trained weights from Keras. Returns path to weights file. """ from keras.utils.data_utils import get_file TF_WEIGHTS_PATH_NO_TOP = 'https://github.com/fchollet/deep-learning-models/'\ 'releases/download/v0.2/'\ 'resnet50_weights_tf_dim_ordering_tf_kernels_notop.h5' weights_path = get_file('resnet50_weights_tf_dim_ordering_tf_kernels_notop.h5', TF_WEIGHTS_PATH_NO_TOP, cache_subdir='models', md5_hash='a268eb855778b3df3c7506639542a6af') return weights_path