forked from keras-team/keras-applications
-
Notifications
You must be signed in to change notification settings - Fork 0
/
resnext.py
38 lines (27 loc) · 1020 Bytes
/
resnext.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
"""ResNeXt models for Keras.
# Reference paper
- [Aggregated Residual Transformations for Deep Neural Networks]
(https://arxiv.org/abs/1611.05431) (CVPR 2017)
# Reference implementations
- [TensorNets]
(https://github.com/taehoonlee/tensornets/blob/master/tensornets/resnets.py)
- [Torch ResNeXt]
(https://github.com/facebookresearch/ResNeXt/blob/master/models/resnext.lua)
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
from . import imagenet_utils
from .imagenet_utils import decode_predictions
from .resnet_common import ResNeXt50
from .resnet_common import ResNeXt101
def preprocess_input(x, **kwargs):
"""Preprocesses a numpy array encoding a batch of images.
# Arguments
x: a 4D numpy array consists of RGB values within [0, 255].
data_format: data format of the image tensor.
# Returns
Preprocessed array.
"""
return imagenet_utils.preprocess_input(x, mode='torch', **kwargs)