SHOW:
|
|
- or go back to the newest paste.
1 | from multiprocessing import Process, Queue | |
2 | from keras.utils.test_utils import keras_test | |
3 | from keras.utils.test_utils import layer_test | |
4 | from keras.utils.generic_utils import CustomObjectScope | |
5 | from keras.models import Sequential | |
6 | from keras import applications | |
7 | from keras import backend as K | |
8 | ||
9 | def test_inceptionresnetv2_notop(): | |
10 | def target(queue): | |
11 | model = applications.InceptionResNetV2(weights=None, include_top=False) | |
12 | queue.put(model.output_shape) | |
13 | global_image_data_format = K.image_data_format() | |
14 | queue = Queue() | |
15 | K.set_image_data_format('channels_first') | |
16 | p = Process(target=target, args=(queue,)) | |
17 | p.start() | |
18 | p.join() | |
19 | K.set_image_data_format(global_image_data_format) | |
20 | assert not queue.empty(), 'Model creation failed.' | |
21 | model_output_shape = queue.get_nowait() | |
22 | assert model_output_shape == (None, 1536, None, None) | |
23 | K.set_image_data_format('channels_last') | |
24 | p = Process(target=target, args=(queue,)) | |
25 | p.start() | |
26 | p.join() | |
27 | K.set_image_data_format(global_image_data_format) | |
28 | assert not queue.empty(), 'Model creation failed.' | |
29 | model_output_shape = queue.get_nowait() | |
30 | assert model_output_shape == (None, None, None, 1536) | |
31 | - | return True |
31 | + | |
32 | ||
33 | ||
34 | - | test_inceptionresnetv2_notop() |
34 | + | |
35 | import time | |
36 | start = time.time() | |
37 | test_inceptionresnetv2_notop() | |
38 | print('Exec time: ' + str(time.time()-start)) |