Skip to content
This repository has been archived by the owner on Dec 2, 2024. It is now read-only.

Commit

Permalink
Merge pull request #49 from nimitdesai92/fix
Browse files Browse the repository at this point in the history
Fix keras imports
  • Loading branch information
datitran authored Oct 17, 2019
2 parents 5cf9368 + 582b711 commit f0eacc8
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 17 deletions.
6 changes: 3 additions & 3 deletions contrib/tf_serving/save_tfs_model.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import keras.backend as K
import tensorflow.keras.backend as K
import argparse
from keras.applications.mobilenet import DepthwiseConv2D, relu6
from keras.utils.generic_utils import CustomObjectScope
from tensorflow.keras.applications.mobilenet import DepthwiseConv2D, relu6
from tensorflow.keras.utils.generic_utils import CustomObjectScope
from tensorflow.python.saved_model import builder as saved_model_builder
from tensorflow.python.saved_model import tag_constants
from tensorflow.python.saved_model.signature_def_utils_impl import \
Expand Down
2 changes: 1 addition & 1 deletion contrib/tf_serving/tfs_sample_client.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import json
import argparse
import keras
import tensorflow.keras as keras
import numpy as np
import tensorflow as tf
from src.utils import utils
Expand Down
2 changes: 1 addition & 1 deletion src/handlers/data_generator.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

import os
import numpy as np
import keras
import tensorflow.keras as keras
from utils import utils


Expand Down
12 changes: 6 additions & 6 deletions src/handlers/model_builder.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

import importlib
from keras.models import Model
from keras.layers import Dropout, Dense
from keras.optimizers import Adam
from tensorflow.keras.models import Model
from tensorflow.keras.layers import Dropout, Dense
from tensorflow.keras.optimizers import Adam
from utils.losses import earth_movers_distance


Expand All @@ -21,11 +21,11 @@ def __init__(self, base_model_name, n_classes=10, learning_rate=0.001, dropout_r
def _get_base_module(self):
# import Keras base model module
if self.base_model_name == 'InceptionV3':
self.base_module = importlib.import_module('keras.applications.inception_v3')
self.base_module = importlib.import_module('tensorflow.keras.applications.inception_v3')
elif self.base_model_name == 'InceptionResNetV2':
self.base_module = importlib.import_module('keras.applications.inception_resnet_v2')
self.base_module = importlib.import_module('tensorflow.keras.applications.inception_resnet_v2')
else:
self.base_module = importlib.import_module('keras.applications.'+self.base_model_name.lower())
self.base_module = importlib.import_module('tensorflow.keras.applications.'+self.base_model_name.lower())

def build(self):
# get base model class
Expand Down
4 changes: 2 additions & 2 deletions src/trainer/train.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

import os
import argparse
from keras import backend as K
from keras.callbacks import ModelCheckpoint
from tensorflow.keras import backend as K
from tensorflow.keras.callbacks import ModelCheckpoint
from sklearn.model_selection import train_test_split
from handlers.data_generator import TrainDataGenerator, TestDataGenerator
from handlers.model_builder import Nima
Expand Down
4 changes: 2 additions & 2 deletions src/utils/keras_utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

import keras.backend as K
from keras.callbacks import TensorBoard
import tensorflow.keras.backend as K
from tensorflow.keras.callbacks import TensorBoard


class TensorBoardBatch(TensorBoard):
Expand Down
2 changes: 1 addition & 1 deletion src/utils/losses.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

from keras import backend as K
from tensorflow.keras import backend as K


def earth_movers_distance(y_true, y_pred):
Expand Down
2 changes: 1 addition & 1 deletion src/utils/utils.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

import os
import json
import keras
import tensorflow.keras as keras
import numpy as np


Expand Down

0 comments on commit f0eacc8

Please sign in to comment.