Created
May 22, 2018 16:52
-
-
Save 0x00b1/26819f0248cdfd92e85b60da44eb1265 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
epoch | loss | |
---|---|---|
0 | 2.0908475583419204 | |
1 | 1.8718141706194729 | |
2 | 1.782610710710287 | |
3 | 1.7201955725904554 | |
4 | 1.6323608455713838 | |
5 | 1.546080261701718 | |
6 | 1.459627388510853 | |
7 | 1.3669737605378032 | |
8 | 1.2746267574839294 | |
9 | 1.2227191367419437 | |
10 | 1.137794711976312 | |
11 | 1.0527031613746658 | |
12 | 0.979208143777214 | |
13 | 0.8874334347201511 | |
14 | 0.8339553142432123 | |
15 | 0.8048522618482821 | |
16 | 0.7365804498549551 | |
17 | 0.7036115619121119 | |
18 | 0.6562772130710073 | |
19 | 0.6076330755022354 | |
20 | 0.5938348099589348 | |
21 | 0.5471071133506484 | |
22 | 0.5106714542780537 | |
23 | 0.4975031659123488 | |
24 | 0.48070369265042245 | |
25 | 0.46764915267704055 | |
26 | 0.41692444423097186 | |
27 | 0.4258015782106668 | |
28 | 0.39562140335328877 | |
29 | 0.3861686653981451 | |
30 | 0.3700766036345158 | |
31 | 0.34749657998327166 | |
32 | 0.3369389744766522 | |
33 | 0.3401913843699731 | |
34 | 0.34175904153380543 | |
35 | 0.32430249580647796 | |
36 | 0.3039112970000133 | |
37 | 0.30038268023054115 | |
38 | 0.28230409196112305 | |
39 | 0.2963737579557346 | |
40 | 0.27980152764939703 | |
41 | 0.3055020935717039 | |
42 | 0.2710205258335918 | |
43 | 0.2692946635361295 | |
44 | 0.2581610641791485 | |
45 | 0.25632580355159007 | |
46 | 0.2555630134884268 | |
47 | 0.2501366164069623 | |
48 | 0.23876912443665788 | |
49 | 0.24236590442887973 | |
50 | 0.25081424428208265 | |
51 | 0.2345584230060922 | |
52 | 0.23107485799118876 | |
53 | 0.24020131600263994 | |
54 | 0.22400415847369004 | |
55 | 0.23056069588346872 | |
56 | 0.23677557364862878 | |
57 | 0.21224146269378252 | |
58 | 0.22275206673657522 | |
59 | 0.21422539569903165 | |
60 | 0.20793529546062928 | |
61 | 0.22584888886194676 | |
62 | 0.21721870017063338 | |
63 | 0.19313854041683953 | |
64 | 0.23528919133241288 | |
65 | 0.22090790430956986 | |
66 | 0.21480917002190836 | |
67 | 0.1965393315476831 | |
68 | 0.18666543381186784 | |
69 | 0.20837615754862782 | |
70 | 0.18661873808014207 | |
71 | 0.18326595052349148 | |
72 | 0.18282864241336938 | |
73 | 0.1711984434077749 | |
74 | 0.1738220987317618 | |
75 | 0.18016200404963456 | |
76 | 0.18227980817027856 | |
77 | 0.17613465720205568 | |
78 | 0.17986830679001287 | |
79 | 0.16812694453983568 | |
80 | 0.17052603443153203 | |
81 | 0.17434561299160123 | |
82 | 0.1671732143877307 | |
83 | 0.1727157640561927 | |
84 | 0.16906007112993393 | |
85 | 0.17947439552517608 | |
86 | 0.17398373724427074 | |
87 | 0.15265433026797837 | |
88 | 0.1524172457793611 | |
89 | 0.15945872931479244 | |
90 | 0.17693433824751992 | |
91 | 0.15488922793520032 | |
92 | 0.15763137079193257 | |
93 | 0.14555985974584473 | |
94 | 0.16596318671508925 | |
95 | 0.15053179378446657 | |
96 | 0.14747048934805207 | |
97 | 0.14496105294529116 | |
98 | 0.17525753570953384 | |
99 | 0.18206189405464102 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 1, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"%matplotlib inline" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 2, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stderr", | |
"output_type": "stream", | |
"text": [ | |
"/usr/local/lib/python3.6/site-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.\n", | |
" from ._conv import register_converters as _register_converters\n", | |
"Using TensorFlow backend.\n" | |
] | |
} | |
], | |
"source": [ | |
"import keras\n", | |
"import tensorflow\n", | |
"\n", | |
"import keras_rcnn.datasets.shape\n", | |
"import keras_rcnn.models\n", | |
"import keras_rcnn.preprocessing\n", | |
"import keras_rcnn.utils" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 3, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"configuration = tensorflow.ConfigProto()\n", | |
"\n", | |
"configuration.gpu_options.allow_growth = True\n", | |
"\n", | |
"configuration.gpu_options.visible_device_list = \"1\"\n", | |
"\n", | |
"session = tensorflow.Session(config=configuration)\n", | |
"\n", | |
"keras.backend.set_session(session)" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": 4, | |
"metadata": {}, | |
"outputs": [], | |
"source": [ | |
"categories = {\n", | |
" \"circle\": 1,\n", | |
" \"rectangle\": 2,\n", | |
" \"triangle\": 3\n", | |
"}\n", | |
"\n", | |
"training_dictionaries, test_dictionaries = keras_rcnn.datasets.shape.load_data()\n", | |
"\n", | |
"generator = keras_rcnn.preprocessing.ObjectDetectionGenerator()\n", | |
"\n", | |
"generator = generator.flow_from_dictionary(\n", | |
" dictionary=training_dictionaries,\n", | |
" categories=categories,\n", | |
" target_size=(256, 256)\n", | |
")\n", | |
"\n", | |
"validation_data = keras_rcnn.preprocessing.ObjectDetectionGenerator()\n", | |
"\n", | |
"validation_data = validation_data.flow_from_dictionary(\n", | |
" dictionary=test_dictionaries,\n", | |
" categories=categories,\n", | |
" target_size=(256, 256)\n", | |
")" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stderr", | |
"output_type": "stream", | |
"text": [ | |
"/storage/com/github/broadinstitute/keras-rcnn/keras_rcnn/models/_rcnn.py:373: UserWarning: Output \"object_detection_2\" missing from loss dictionary. We assume this was done on purpose, and we will not be expecting any data to be passed to \"object_detection_2\" during training.\n", | |
" super(RCNN, self).compile(optimizer, None)\n", | |
"/usr/local/lib/python3.6/site-packages/tensorflow/python/ops/gradients_impl.py:100: UserWarning: Converting sparse IndexedSlices to a dense Tensor of unknown shape. This may consume a large amount of memory.\n", | |
" \"Converting sparse IndexedSlices to a dense Tensor of unknown shape. \"\n" | |
] | |
}, | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"Epoch 1/100\n" | |
] | |
}, | |
{ | |
"name": "stderr", | |
"output_type": "stream", | |
"text": [ | |
"/home/0x00b1/com/github/scikit-image/scikit-image/skimage/transform/_warps.py:24: UserWarning: The default multichannel argument (None) is deprecated. Please specify either True or False explicitly. multichannel will default to False starting with release 0.16.\n", | |
" warn('The default multichannel argument (None) is deprecated. Please '\n", | |
"/home/0x00b1/com/github/scikit-image/scikit-image/skimage/transform/_warps.py:105: UserWarning: The default mode, 'constant', will be changed to 'reflect' in skimage 0.15.\n", | |
" warn(\"The default mode, 'constant', will be changed to 'reflect' in \"\n", | |
"/home/0x00b1/com/github/scikit-image/scikit-image/skimage/transform/_warps.py:110: UserWarning: Anti-aliasing will be enabled by default in skimage 0.15 to avoid aliasing artifacts when down-sampling images.\n", | |
" warn(\"Anti-aliasing will be enabled by default in skimage 0.15 to \"\n" | |
] | |
}, | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"256/256 [==============================] - 45s 175ms/step - loss: 2.0908\n", | |
"Epoch 2/100\n", | |
"256/256 [==============================] - 41s 161ms/step - loss: 1.8718\n", | |
"Epoch 3/100\n", | |
"256/256 [==============================] - 41s 159ms/step - loss: 1.7826\n", | |
"Epoch 4/100\n", | |
"256/256 [==============================] - 40s 158ms/step - loss: 1.7202\n", | |
"Epoch 5/100\n", | |
"256/256 [==============================] - 40s 157ms/step - loss: 1.6324\n", | |
"Epoch 6/100\n", | |
"256/256 [==============================] - 40s 157ms/step - loss: 1.5461\n", | |
"Epoch 7/100\n", | |
"256/256 [==============================] - 40s 156ms/step - loss: 1.4596\n", | |
"Epoch 8/100\n", | |
"256/256 [==============================] - 40s 155ms/step - loss: 1.3670\n", | |
"Epoch 9/100\n", | |
"256/256 [==============================] - 43s 166ms/step - loss: 1.2746\n", | |
"Epoch 10/100\n", | |
"256/256 [==============================] - 43s 166ms/step - loss: 1.2227\n", | |
"Epoch 11/100\n", | |
"256/256 [==============================] - 41s 161ms/step - loss: 1.1378\n", | |
"Epoch 12/100\n", | |
"256/256 [==============================] - 41s 158ms/step - loss: 1.0527\n", | |
"Epoch 13/100\n", | |
"256/256 [==============================] - 40s 157ms/step - loss: 0.9792\n", | |
"Epoch 14/100\n", | |
"256/256 [==============================] - 40s 155ms/step - loss: 0.8874\n", | |
"Epoch 15/100\n", | |
"256/256 [==============================] - 39s 154ms/step - loss: 0.8340\n", | |
"Epoch 16/100\n", | |
"256/256 [==============================] - 40s 155ms/step - loss: 0.8049\n", | |
"Epoch 17/100\n", | |
"256/256 [==============================] - 39s 153ms/step - loss: 0.7366\n", | |
"Epoch 18/100\n", | |
"256/256 [==============================] - 39s 153ms/step - loss: 0.7036\n", | |
"Epoch 19/100\n", | |
"256/256 [==============================] - 40s 154ms/step - loss: 0.6563\n", | |
"Epoch 20/100\n", | |
"256/256 [==============================] - 41s 161ms/step - loss: 0.6076\n", | |
"Epoch 21/100\n", | |
"256/256 [==============================] - 41s 160ms/step - loss: 0.5938\n", | |
"Epoch 22/100\n", | |
"256/256 [==============================] - 39s 154ms/step - loss: 0.5471\n", | |
"Epoch 23/100\n", | |
"256/256 [==============================] - 39s 154ms/step - loss: 0.5107\n", | |
"Epoch 24/100\n", | |
"256/256 [==============================] - 39s 152ms/step - loss: 0.4975\n", | |
"Epoch 25/100\n", | |
"256/256 [==============================] - 39s 154ms/step - loss: 0.4807\n", | |
"Epoch 26/100\n", | |
"165/256 [==================>...........] - ETA: 13s - loss: 0.4598" | |
] | |
} | |
], | |
"source": [ | |
"learning_rate = 0.0001\n", | |
"\n", | |
"keras.backend.set_learning_phase(1)\n", | |
"\n", | |
"model = keras_rcnn.models.RCNN(\n", | |
" backbone=keras_rcnn.models.backbone.VGG19,\n", | |
" categories=categories.keys(),\n", | |
" dense_units=512,\n", | |
" input_shape=(256, 256, 3)\n", | |
")\n", | |
"\n", | |
"optimizer = keras.optimizers.Adam(learning_rate)\n", | |
"\n", | |
"model.compile(optimizer)\n", | |
"\n", | |
"filename = \"shape-weights-{}.hdf5\".format(learning_rate)\n", | |
"\n", | |
"callbacks = [\n", | |
" keras.callbacks.ModelCheckpoint(filename, \"loss\", save_best_only=True, save_weights_only=True),\n", | |
" keras.callbacks.CSVLogger(\"shape-{}.csv\".format(learning_rate)),\n", | |
" keras.callbacks.TerminateOnNaN()\n", | |
"]\n", | |
"\n", | |
"model.fit_generator(\n", | |
" callbacks=callbacks,\n", | |
" epochs=100,\n", | |
" generator=generator\n", | |
")" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"metadata": {}, | |
"outputs": [], | |
"source": [] | |
} | |
], | |
"metadata": { | |
"kernelspec": { | |
"display_name": "Python 3", | |
"language": "python", | |
"name": "python3" | |
}, | |
"language_info": { | |
"codemirror_mode": { | |
"name": "ipython", | |
"version": 3 | |
}, | |
"file_extension": ".py", | |
"mimetype": "text/x-python", | |
"name": "python", | |
"nbconvert_exporter": "python", | |
"pygments_lexer": "ipython3", | |
"version": "3.6.4" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 2 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment