diff --git a/src/.ipynb_checkpoints/Untitled-checkpoint.ipynb b/src/.ipynb_checkpoints/Untitled-checkpoint.ipynb index 4f73a2b..38b9a9c 100644 --- a/src/.ipynb_checkpoints/Untitled-checkpoint.ipynb +++ b/src/.ipynb_checkpoints/Untitled-checkpoint.ipynb @@ -3,7 +3,7 @@ { "cell_type": "code", "execution_count": 3, - "id": "db0b0a11", + "id": "769c9afd", "metadata": {}, "outputs": [ { @@ -40,7 +40,7 @@ { "cell_type": "code", "execution_count": 4, - "id": "377355df", + "id": "227c58c5", "metadata": {}, "outputs": [], "source": [ @@ -49,8 +49,25 @@ }, { "cell_type": "code", + "execution_count": 9, + "id": "dc65195f", + "metadata": {}, + "outputs": [], + "source": [ + "import time\n", + "def run_time(func):\n", + " def inner(model, image, question):\n", + " back = func(model, image, question)\n", + " print(\"Runned time: {} s\".format(round((time.time() - t)/10, 3)))\n", + " return back\n", + " t = time.time()\n", + " return inner" + ] + }, + { + "cell_type": "code", "execution_count": 8, - "id": "fd4ec8ee", + "id": "bcbe551f", "metadata": {}, "outputs": [], "source": [ @@ -63,10 +80,11 @@ { "cell_type": "code", "execution_count": 6, - "id": "cc76d61f", + "id": "36fcb0d9", "metadata": {}, "outputs": [], "source": [ + "@run_time\n", "def inference(model_PATH, img_p):\n", " G_Z = tf.placeholder(tf.float32, shape=[None, IMAGE_SZ, IMAGE_SZ, 4], name='G_Z')\n", " G_sample = model.generator(G_Z)\n", @@ -84,7 +102,7 @@ { "cell_type": "code", "execution_count": null, - "id": "d93edf59", + "id": "b79deb86", "metadata": {}, "outputs": [], "source": [ diff --git a/src/Untitled.ipynb b/src/Untitled.ipynb index 6966702..972576c 100644 --- a/src/Untitled.ipynb +++ b/src/Untitled.ipynb @@ -3,7 +3,7 @@ { "cell_type": "code", "execution_count": 3, - "id": "ea42a489", + "id": "3c86ef8a", "metadata": {}, "outputs": [ { @@ -40,7 +40,7 @@ { "cell_type": "code", "execution_count": 4, - "id": "24a28be9", + "id": "87b58a5a", "metadata": {}, "outputs": [], "source": [ @@ -49,8 +49,25 @@ }, { "cell_type": "code", + "execution_count": 9, + "id": "4e963aed", + "metadata": {}, + "outputs": [], + "source": [ + "import time\n", + "def run_time(func):\n", + " def inner(model, image, question):\n", + " back = func(model, image, question)\n", + " print(\"Runned time: {} s\".format(round((time.time() - t)/10, 3)))\n", + " return back\n", + " t = time.time()\n", + " return inner" + ] + }, + { + "cell_type": "code", "execution_count": 8, - "id": "2f04ed3d", + "id": "aba8e440", "metadata": {}, "outputs": [], "source": [ @@ -63,10 +80,11 @@ { "cell_type": "code", "execution_count": 6, - "id": "4cc717e4", + "id": "bc8c0bf4", "metadata": {}, "outputs": [], "source": [ + "@run_time\n", "def inference(model_PATH, img_p):\n", " G_Z = tf.placeholder(tf.float32, shape=[None, IMAGE_SZ, IMAGE_SZ, 4], name='G_Z')\n", " G_sample = model.generator(G_Z)\n", @@ -84,7 +102,7 @@ { "cell_type": "code", "execution_count": null, - "id": "9ce2fc25", + "id": "5c1557b3", "metadata": {}, "outputs": [], "source": [