Delete model.py
Browse files
model.py
DELETED
|
@@ -1,44 +0,0 @@
|
|
| 1 |
-
import os
|
| 2 |
-
import numpy as np
|
| 3 |
-
import tensorflow as tf
|
| 4 |
-
from tensorflow.keras.layers import *
|
| 5 |
-
|
| 6 |
-
#os.environ["CUDA_VISIBLE_DEVICES"] = "-1"
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
class OrientationClassifier(tf.keras.Model):
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
def __init__(self,input_shape,hidden_dim,no_classes=1,isTrainable = False):
|
| 14 |
-
super().__init__()
|
| 15 |
-
resnet = tf.keras.applications.resnet50.ResNet50(include_top=False,input_shape=input_shape)
|
| 16 |
-
resnet.trainable = isTrainable
|
| 17 |
-
|
| 18 |
-
self.featureExtractor = tf.keras.models.Sequential([
|
| 19 |
-
resnet,
|
| 20 |
-
GlobalAveragePooling2D()
|
| 21 |
-
])
|
| 22 |
-
|
| 23 |
-
self.classifier = tf.keras.models.Sequential([
|
| 24 |
-
Dense(hidden_dim,activation = 'relu'),
|
| 25 |
-
BatchNormalization(),
|
| 26 |
-
|
| 27 |
-
Dense(hidden_dim/2,activation = 'relu'),
|
| 28 |
-
BatchNormalization(),
|
| 29 |
-
|
| 30 |
-
Dense(hidden_dim/4,activation = 'relu'),
|
| 31 |
-
BatchNormalization(),
|
| 32 |
-
|
| 33 |
-
Dense(no_classes,activation = 'sigmoid')
|
| 34 |
-
])
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
def call(self, inputs):
|
| 38 |
-
|
| 39 |
-
x = self.featureExtractor(inputs)
|
| 40 |
-
|
| 41 |
-
preds = self.classifier(x)
|
| 42 |
-
|
| 43 |
-
return preds
|
| 44 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|