Skip to content

Commit

Permalink
Fixed merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
namish800 committed Nov 5, 2018
2 parents 2d55052 + 4b7e3ed commit 96c2cec
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/source/tested_models.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@

## Segmentation
* Image Segmentation CRF-RNN [\[Source\]](https://github.com/torrvision/crfasrnn/tree/master/python-scripts)[\[Visualise\]](http://fabrik.cloudcv.org/caffe/load?id=20180111183110okaux)
* UNET [\[Source\]](https://github.com/ZFTurbo/ZF_UNET_224_Pretrained_Model)[\[Visualise]](http://fabrik.cloudcv.org/caffe/load?id=20180116070834rggzh)
* UNET [\[Source\]](https://github.com/ZFTurbo/ZF_UNET_224_Pretrained_Model)[\[Visualise\]](http://fabrik.cloudcv.org/caffe/load?id=20180116070834rggzh)

### Miscellaneous

Expand Down
1 change: 1 addition & 0 deletions ide/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ def export_keras_json(net, net_name, is_tf, reply_channel):
'TanH': activation,
'Sigmoid': activation,
'HardSigmoid': activation,
'Linear': activation,
'Dropout': dropout,
'Flatten': flatten,
'Reshape': reshape,
Expand Down
1 change: 1 addition & 0 deletions keras_app/views/export_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ def export_json(request, is_tf=False):
'TanH': activation,
'Sigmoid': activation,
'HardSigmoid': activation,
'Linear': activation,
'Dropout': dropout,
'Flatten': flatten,
'Reshape': reshape,
Expand Down
1 change: 1 addition & 0 deletions keras_app/views/import_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ def import_json(request):
'tanh': Activation,
'sigmoid': Activation,
'hard_sigmoid': Activation,
'linear': Activation,
'Dropout': Dropout,
'Flatten': Flatten,
'Reshape': Reshape,
Expand Down
2 changes: 2 additions & 0 deletions keras_app/views/layers_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ def activation(layer, layer_in, layerId, tensor=True):
out[layerId] = Activation('softsign')
elif (layer['info']['type'] == 'HardSigmoid'):
out[layerId] = Activation('hard_sigmoid')
elif (layer['info']['type'] == 'Linear'):
out[layerId] = Activation('linear')
if tensor:
out[layerId] = out[layerId](*layer_in)
return out
Expand Down
3 changes: 2 additions & 1 deletion keras_app/views/layers_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ def Activation(layer):
'selu': 'SELU',
'softplus': 'Softplus',
'softsign': 'Softsign',
'hard_sigmoid': 'HardSigmoid'
'hard_sigmoid': 'HardSigmoid',
'linear': 'Linear'
}
if (layer.__class__.__name__ == 'Activation'):
return jsonLayer(activationMap[layer.activation.func_name], {}, layer)
Expand Down
15 changes: 15 additions & 0 deletions tests/unit/keras_app/keras_export_test.json
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,21 @@
"inplace": true
}
},
"Linear": {
"connection": {
"input": [
"l0"
],
"ouput": []
},
"info": {
"phase": null,
"type": "Linear"
},
"params": {
"inplace": true
}
},
"Upsample": {
"info": {
"phase": null,
Expand Down
23 changes: 23 additions & 0 deletions tests/unit/keras_app/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,11 @@ def test_keras_import(self):
model.add(ThresholdedReLU(theta=1, input_shape=(15,)))
model.build()
self.keras_type_test(model, 0, 'ThresholdedReLU')
# Linear
model = Sequential()
model.add(Activation('linear', input_shape=(15,)))
model.build()
self.keras_type_test(model, 0, 'Linear')


class DropoutImportTest(unittest.TestCase, HelperFunctions):
Expand Down Expand Up @@ -943,6 +948,24 @@ def test_keras_export(self):
self.assertEqual(model.layers[1].__class__.__name__, 'Activation')


class LinearActivationExportTest(unittest.TestCase):
def setUp(self):
self.client = Client()

def test_keras_export(self):
tests = open(os.path.join(settings.BASE_DIR, 'tests', 'unit', 'keras_app',
'keras_export_test.json'), 'r')
response = json.load(tests)
tests.close()
net = yaml.safe_load(json.dumps(response['net']))
net = {'l0': net['Input'], 'l1': net['Linear']}
net['l0']['connection']['output'].append('l1')
inp = data(net['l0'], '', 'l0')['l0']
net = activation(net['l1'], [inp], 'l1')
model = Model(inp, net['l1'])
self.assertEqual(model.layers[1].__class__.__name__, 'Activation')


class DropoutExportTest(unittest.TestCase):
def setUp(self):
self.client = Client()
Expand Down
2 changes: 1 addition & 1 deletion tutorials/tested_models.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

## Segmentation
* Image Segmentation CRF-RNN [\[Source\]](https://github.com/torrvision/crfasrnn/tree/master/python-scripts)[\[Visualise\]](http://fabrik.cloudcv.org/caffe/load?id=20180111183110okaux)
* UNET [\[Source\]](https://github.com/ZFTurbo/ZF_UNET_224_Pretrained_Model)[\[Visualise]](http://fabrik.cloudcv.org/caffe/load?id=20180116070834rggzh)
* UNET [\[Source\]](https://github.com/ZFTurbo/ZF_UNET_224_Pretrained_Model)[\[Visualise\]](http://fabrik.cloudcv.org/caffe/load?id=20180116070834rggzh)

### Miscellaneous

Expand Down

0 comments on commit 96c2cec

Please sign in to comment.