Weiyu Peng
Published

Heat Map for Self-driving Model

This post gives a brief introduction of how to visualize your self-driving model. it can be very helpful for the model debugging.

IntermediateProtip1,042
Heat Map for Self-driving Model

Story

Read more

Code

Full code

Python
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "import os\n",
    "os.environ['KERAS_BACKEND'] = 'theano'\n",
    "#os.environ['KERAS_BACKEND'] = 'tensorflow'\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/envs/donkey/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 Theano backend.\n",
      "WARNING (theano.configdefaults): install mkl with `conda install mkl-service`: No module named 'mkl'\n"
     ]
    }
   ],
   "source": [
    "from keras.layers import Input, Dense, merge\n",
    "from keras.models import Model, load_model\n",
    "from keras.layers import Convolution2D, MaxPooling2D, Reshape, BatchNormalization\n",
    "from keras.layers import Activation, Dropout, Flatten, Dense"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Add your model here:\n",
    "model_path = \"crop22219\"\n",
    "#shape of your conv input\n",
    "conv_shape = (120, 100, 3)\n",
    "orignal_shape = (120, 160, 3)\n",
    "pre_process_layers = 2\n",
    "conv_layers = 5"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "/anaconda3/envs/donkey/lib/python3.6/site-packages/keras/utils/conv_utils.py:82: FutureWarning: Using a non-tuple sequence for multidimensional indexing is deprecated; use `arr[tuple(seq)]` instead of `arr[seq]`. In the future this will be interpreted as an array index, `arr[np.array(seq)]`, which will result either in an error or a different result.\n",
      "  return np.copy(kernel[slices])\n"
     ]
    }
   ],
   "source": [
    "if model_path != None:\n",
    "    model= load_model(model_path)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "img_in = Input(shape=conv_shape, name='img_in') \n",
    "x = img_in\n",
    "x = Convolution2D(24, (5,5), strides=(2,2), activation='relu', name='conv1')(x)\n",
    "x = Convolution2D(32, (5,5), strides=(2,2), activation='relu', name='conv2')(x)\n",
    "x = Convolution2D(64, (5,5), strides=(2,2), activation='relu', name='conv3')(x)\n",
    "x = Convolution2D(64, (3,3), strides=(2,2), activation='relu', name='conv4')(x)\n",
    "conv_5 = Convolution2D(64, (3,3), strides=(1,1), activation='relu', name='conv5')(x)\n",
    "convolution_part = Model(inputs=[img_in], outputs=[conv_5])\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "__________________________________________________________________________________________________\n",
      "Layer (type)                    Output Shape         Param #     Connected to                     \n",
      "==================================================================================================\n",
      "img_in (InputLayer)             (None, 120, 160, 3)  0                                            \n",
      "__________________________________________________________________________________________________\n",
      "cropping2d_1 (Cropping2D)       (None, 120, 100, 3)  0           img_in[0][0]                     \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_1 (Conv2D)               (None, 58, 48, 24)   1824        cropping2d_1[0][0]               \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_2 (Conv2D)               (None, 27, 22, 32)   19232       conv2d_1[0][0]                   \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_3 (Conv2D)               (None, 12, 9, 64)    51264       conv2d_2[0][0]                   \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_4 (Conv2D)               (None, 5, 4, 64)     36928       conv2d_3[0][0]                   \n",
      "__________________________________________________________________________________________________\n",
      "conv2d_5 (Conv2D)               (None, 3, 2, 64)     36928       conv2d_4[0][0]                   \n",
      "__________________________________________________________________________________________________\n",
      "flattened (Flatten)             (None, 384)          0           conv2d_5[0][0]                   \n",
      "__________________________________________________________________________________________________\n",
      "dense_1 (Dense)                 (None, 100)          38500       flattened[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "dropout_1 (Dropout)             (None, 100)          0           dense_1[0][0]                    \n",
      "__________________________________________________________________________________________________\n",
      "dense_2 (Dense)                 (None, 50)           5050        dropout_1[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "dropout_2 (Dropout)             (None, 50)           0           dense_2[0][0]                    \n",
      "__________________________________________________________________________________________________\n",
      "angle_out (Dense)               (None, 1)            51          dropout_2[0][0]                  \n",
      "__________________________________________________________________________________________________\n",
      "throttle_out (Dense)            (None, 1)            51          dropout_2[0][0]                  \n",
      "==================================================================================================\n",
      "Total params: 189,828\n",
      "Trainable params: 189,828\n",
      "Non-trainable params: 0\n",
      "__________________________________________________________________________________________________\n",
      "None\n",
      "['img_in', 'cropping2d_1', 'conv2d_1', 'conv2d_2', 'conv2d_3', 'conv2d_4', 'conv2d_5', 'flattened', 'dense_1', 'dropout_1', 'dense_2', 'dropout_2', 'angle_out', 'throttle_out']\n"
     ]
    }
   ],
   "source": [
    "layers = model.layers\n",
    "print(model.summary())\n",
    "print([i.name  for i in layers])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['img_in', 'cropping2d_1']\n",
      "['conv2d_1', 'conv2d_2', 'conv2d_3', 'conv2d_4', 'conv2d_5']\n"
     ]
    }
   ],
   "source": [
    "pre = layers[:pre_process_layers]\n",
    "layers = layers[pre_process_layers:pre_process_layers+conv_layers]\n",
    "print([i.name  for i in pre])\n",
    "print([i.name  for i in layers])\n",
    "for layer_num in ('1', '2', '3', '4', '5'):\n",
    "    convolution_part.get_layer('conv' + layer_num).set_weights(layers[int(layer_num)-1].get_weights())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "from keras import backend as K\n",
    "from keras.layers import Cropping2D\n",
    "inp = convolution_part.input                                           \n",
    "outputs = [layer.output for layer in convolution_part.layers]          \n",
    "functor = K.function([inp], outputs)\n",
    "\n",
    "inp = Input(shape=orignal_shape, name='img_in') \n",
    "outputs = Cropping2D(cropping=((0,0),(60,0)))(inp)\n",
    "pre_functor = K.function([inp], outputs)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "import tensorflow as tf"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "kernel_3x3 = tf.constant(np.array([\n",
    "        [[[1]], [[1]], [[1]]], \n",
    "        [[[1]], [[1]], [[1]]], \n",
    "        [[[1]], [[1]], [[1]]]\n",
    "]), tf.float32)\n",
    "\n",
    "kernel_5x5 = tf.constant(np.array([\n",
    "        [[[1]], [[1]], [[1]], [[1]], [[1]]], \n",
    "        [[[1]], [[1]], [[1]], [[1]], [[1]]], \n",
    "        [[[1]], [[1]], [[1]], [[1]], [[1]]],\n",
    "        [[[1]], [[1]], [[1]], [[1]], [[1]]],\n",
    "        [[[1]], [[1]], [[1]], [[1]], [[1]]]\n",
    "]), tf.float32)\n",
    "\n",
    "layers_kernels = {5: kernel_3x3, 4: kernel_3x3, 3: kernel_5x5, 2: kernel_5x5, 1: kernel_5x5}\n",
    "\n",
    "layers_strides = {5: [1, 1, 1, 1], 4: [1, 2, 2, 1], 3: [1, 2, 2, 1], 2: [1, 2, 2, 1], 1: [1, 2, 2, 1]}\n",
    "\n",
    "def compute_visualisation_mask(img):\n",
    "    activations = functor([np.array([img])])\n",
    "    init_shape = activations[-1].shape[1:3]\n",
    "    print(init_shape)\n",
    "    upscaled_activation = np.ones(init_shape)\n",
    "    for layer in [5, 4, 3, 2, 1]:\n",
    "        \n",
    "        print('mean shape', np.mean(activations[layer], axis=3).shape)\n",
    "        averaged_activation = np.mean(activations[layer], axis=3).squeeze(axis=0) * upscaled_activation\n",
    "        print('squeee', averaged_activation.shape)\n",
    "        #output shape: what next level looks like\n",
    "        output_shape = (activations[layer - 1].shape[1], activations[layer - 1].shape[2])\n",
    "        \n",
    "        x = tf.constant(\n",
    "            np.reshape(averaged_activation, (1,averaged_activation.shape[0],averaged_activation.shape[1],1)),\n",
    "            tf.float32\n",
    "        )\n",
    "        print('reshape to four dimensions: ',np.reshape(averaged_activation, (1,averaged_activation.shape[0],averaged_activation.shape[1],1)).shape)\n",
    "        #Deconvolution https://datascience.stackexchange.com/questions/6107/what-are-deconvolutional-layers\n",
    "        conv = tf.nn.conv2d_transpose(\n",
    "            x, layers_kernels[layer],\n",
    "            output_shape=(1,output_shape[0],output_shape[1], 1), \n",
    "            strides=layers_strides[layer], \n",
    "            padding='VALID'\n",
    "        )\n",
    "        with tf.Session() as session:\n",
    "            result = session.run(conv)\n",
    "        print('result', result.shape)\n",
    "        upscaled_activation = np.reshape(result, output_shape)\n",
    "        print('after change shape:', upscaled_activation.shape)\n",
    "    final_visualisation_mask = upscaled_activation\n",
    "    print('np.final_visualisation_mask!', np.max(final_visualisation_mask))\n",
    "    return (final_visualisation_mask - np.min(final_visualisation_mask))/(np.max(final_visualisation_mask) - np.min(final_visualisation_mask))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [],
   "source": [
    "import cv2\n",
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [],
   "source": [
    "from matplotlib import pyplot as plt\n",
    "%matplotlib inline"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "from matplotlib import animation\n",
    "from IPython.display import display, HTML\n",
    "\n",
    "def plot_movie_mp4(image_array):\n",
    "    dpi = 72.0\n",
    "    xpixels, ypixels = image_array[0].shape[0], image_array[0].shape[1]\n",
    "    fig = plt.figure(figsize=(ypixels/dpi, xpixels/dpi), dpi=dpi)\n",
    "    im = plt.figimage(image_array[0])\n",
    "\n",
    "    def animate(i):\n",
    "        im.set_array(image_array[i])\n",
    "        return (im,)\n",
    "\n",
    "    anim = animation.FuncAnimation(fig, animate, frames=len(image_array))\n",
    "    anim.save('out.mp4')\n",
    "    display(HTML(anim.to_html5_video()))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [],
   "source": [
    "from glob import iglob"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(3, 2)\n",
      "mean shape (1, 3, 2)\n",
      "squeee (3, 2)\n",
      "reshape to four dimensions:  (1, 3, 2, 1)\n",
      "result (1, 5, 4, 1)\n",
      "after change shape: (5, 4)\n",
      "mean shape (1, 5, 4)\n",
      "squeee (5, 4)\n",
      "reshape to four dimensions:  (1, 5, 4, 1)\n",
      "result (1, 12, 9, 1)\n",
      "after change shape: (12, 9)\n",
      "mean shape (1, 12, 9)\n",
      "squeee (12, 9)\n",
      "reshape to four dimensions:  (1, 12, 9, 1)\n",
      "result (1, 27, 22, 1)\n",
      "after change shape: (27, 22)\n",
      "mean shape (1, 27, 22)\n",
      "squeee (27, 22)\n",
      "reshape to four dimensions:  (1, 27, 22, 1)\n",
      "result (1, 58, 48, 1)\n",
      "after change shape: (58, 48)\n",
      "mean shape (1, 58, 48)\n",
      "squeee (58, 48)\n",
      "reshape to four dimensions:  (1, 58, 48, 1)\n",
      "result (1, 120, 100, 1)\n",
      "after change shape: (120, 100)\n",
      "np.final_visualisation_mask! 3136.817\n",
      "(3, 2)\n",
      "mean shape (1, 3, 2)\n",
      "squeee (3, 2)\n",
      "reshape to four dimensions:  (1, 3, 2, 1)\n",
      "result (1, 5, 4, 1)\n",
      "after change shape: (5, 4)\n",
      "mean shape (1, 5, 4)\n",
      "squeee (5, 4)\n",
      "reshape to four dimensions:  (1, 5, 4, 1)\n",
      "result (1, 12, 9, 1)\n",
      "after change shape: (12, 9)\n",
      "mean shape (1, 12, 9)\n",
      "squeee (12, 9)\n",
      "reshape to four dimensions:  (1, 12, 9, 1)\n",
      "result (1, 27, 22, 1)\n",
      "after change shape: (27, 22)\n",
      "mean shape (1, 27, 22)\n",
      "squeee (27, 22)\n",
      "reshape to four dimensions:  (1, 27, 22, 1)\n",
      "result (1, 58, 48, 1)\n",
      "after change shape: (58, 48)\n",
      "mean shape (1, 58, 48)\n",
      "squeee (58, 48)\n",
      "reshape to four dimensions:  (1, 58, 48, 1)\n",
      "result (1, 120, 100, 1)\n",
      "after change shape: (120, 100)\n",
      "np.final_visualisation_mask! 2670.2732\n",
      "(3, 2)\n",
      "mean shape (1, 3, 2)\n",
      "squeee (3, 2)\n",
      "reshape to four dimensions:  (1, 3, 2, 1)\n",
      "result (1, 5, 4, 1)\n",
      "after change shape: (5, 4)\n",
      "mean shape (1, 5, 4)\n",
      "squeee (5, 4)\n",
      "reshape to four dimensions:  (1, 5, 4, 1)\n",
      "result (1, 12, 9, 1)\n",
      "after change shape: (12, 9)\n",
      "mean shape (1, 12, 9)\n",
      "squeee (12, 9)\n",
      "reshape to four dimensions:  (1, 12, 9, 1)\n",
      "result (1, 27, 22, 1)\n",
      "after change shape: (27, 22)\n",
      "mean shape (1, 27, 22)\n",
      "squeee (27, 22)\n",
      "reshape to four dimensions:  (1, 27, 22, 1)\n",
      "result (1, 58, 48, 1)\n",
      "after change shape: (58, 48)\n",
      "mean shape (1, 58, 48)\n",
      "squeee (58, 48)\n",
      "reshape to four dimensions:  (1, 58, 48, 1)\n",
      "result (1, 120, 100, 1)\n",
      "after change shape: (120, 100)\n",
      "np.final_visualisation_mask! 3922.9458\n",
      "(3, 2)\n",
      "mean shape (1, 3, 2)\n",
      "squeee (3, 2)\n",
      "reshape to four dimensions:  (1, 3, 2, 1)\n",
      "result (1, 5, 4, 1)\n",
      "after change shape: (5, 4)\n",
      "mean shape (1, 5, 4)\n",
      "squeee (5, 4)\n",
      "reshape to four dimensions:  (1, 5, 4, 1)\n",
      "result (1, 12, 9, 1)\n",
      "after change shape: (12, 9)\n",
      "mean shape (1, 12, 9)\n",
      "squeee (12, 9)\n",
      "reshape to four dimensions:  (1, 12, 9, 1)\n",
      "result (1, 27, 22, 1)\n",
      "after change shape: (27, 22)\n",
      "mean shape (1, 27, 22)\n",
      "squeee (27, 22)\n",
      "reshape to four dimensions:  (1, 27, 22, 1)\n",
      "result (1, 58, 48, 1)\n",
      "after change shape: (58, 48)\n",
      "mean shape (1, 58, 48)\n",
      "squeee (58, 48)\n",
      "reshape to four dimensions:  (1, 58, 48, 1)\n",
      "result (1, 120, 100, 1)\n",
      "after change shape: (120, 100)\n",
      "np.final_visualisation_mask! 4585.973\n",
      "(3, 2)\n",
      "mean shape (1, 3, 2)\n",
      "squeee (3, 2)\n",
      "reshape to four dimensions:  (1, 3, 2, 1)\n",
      "result (1, 5, 4, 1)\n",
      "after change shape: (5, 4)\n",
      "mean shape (1, 5, 4)\n",
      "squeee (5, 4)\n",
      "reshape to four dimensions:  (1, 5, 4, 1)\n",
      "result (1, 12, 9, 1)\n",
      "after change shape: (12, 9)\n",
      "mean shape (1, 12, 9)\n",
      "squeee (12, 9)\n",
      "reshape to four dimensions:  (1, 12, 9, 1)\n",
      "result (1, 27, 22, 1)\n",
      "after change shape: (27, 22)\n",
      "mean shape (1, 27, 22)\n",
      "squeee (27, 22)\n",
      "reshape to four dimensions:  (1, 27, 22, 1)\n",
      "result (1, 58, 48, 1)\n",
      "after change shape: (58, 48)\n",
      "mean shape (1, 58, 48)\n",
      "squeee (58, 48)\n",
      "reshape to four dimensions:  (1, 58, 48, 1)\n",
      "result (1, 120, 100, 1)\n",
      "after change shape: (120, 100)\n",
      "np.final_visualisation_mask! 4344.6567\n",
      "(3, 2)\n",
      "mean shape (1, 3, 2)\n",
      "squeee (3, 2)\n",
      "reshape to four dimensions:  (1, 3, 2, 1)\n",
      "result (1, 5, 4, 1)\n",
      "after change shape: (5, 4)\n",
      "mean shape (1, 5, 4)\n",
      "squeee (5, 4)\n",
      "reshape to four dimensions:  (1, 5, 4, 1)\n",
      "result (1, 12, 9, 1)\n",
      "after change shape: (12, 9)\n",
      "mean shape (1, 12, 9)\n",
      "squeee (12, 9)\n",
      "reshape to four dimensions:  (1, 12, 9, 1)\n",
      "result (1, 27, 22, 1)\n",
      "after change shape: (27, 22)\n",
      "mean shape (1, 27, 22)\n",
      "squeee (27, 22)\n",
      "reshape to four dimensions:  (1, 27, 22, 1)\n",
      "result (1, 58, 48, 1)\n",
      "after change shape: (58, 48)\n",
      "mean shape (1, 58, 48)\n",
      "squeee (58, 48)\n",
      "reshape to four dimensions:  (1, 58, 48, 1)\n",
      "result (1, 120, 100, 1)\n",
      "after change shape: (120, 100)\n",
      "np.final_visualisation_mask! 5153.141\n",
      "(3, 2)\n",
      "mean shape (1, 3, 2)\n",
      "squeee (3, 2)\n",
      "reshape to four dimensions:  (1, 3, 2, 1)\n",
      "result (1, 5, 4, 1)\n",
      "after change shape: (5, 4)\n",
      "mean shape (1, 5, 4)\n",
      "squeee (5, 4)\n",
      "reshape to four dimensions:  (1, 5, 4, 1)\n",
      "result (1, 12, 9, 1)\n",
      "after change shape: (12, 9)\n",
      "mean shape (1, 12, 9)\n",
      "squeee (12, 9)\n",
      "reshape to four dimensions:  (1, 12, 9, 1)\n",
      "result (1, 27, 22, 1)\n",
      "after change shape: (27, 22)\n",
      "mean shape (1, 27, 22)\n",
      "squeee (27, 22)\n",
      "reshape to four dimensions:  (1, 27, 22, 1)\n",
      "result (1, 58, 48, 1)\n",
      "after change shape: (58, 48)\n",
      "mean shape (1, 58, 48)\n",
      "squeee (58, 48)\n",
      "reshape to four dimensions:  (1, 58, 48, 1)\n",
      "result (1, 120, 100, 1)\n",
      "after change shape: (120, 100)\n",
      "np.final_visualisation_mask! 6498.038\n",
      "(3, 2)\n",
      "mean shape (1, 3, 2)\n",
      "squeee (3, 2)\n",
      "reshape to four dimensions:  (1, 3, 2, 1)\n",
      "result (1, 5, 4, 1)\n",
      "after change shape: (5, 4)\n",
      "mean shape (1, 5, 4)\n",
      "squeee (5, 4)\n",
      "reshape to four dimensions:  (1, 5, 4, 1)\n",
      "result (1, 12, 9, 1)\n",
      "after change shape: (12, 9)\n",
      "mean shape (1, 12, 9)\n",
      "squeee (12, 9)\n",
      "reshape to four dimensions:  (1, 12, 9, 1)\n",
      "result (1, 27, 22, 1)\n",
      "after change shape: (27, 22)\n",
      "mean shape (1, 27, 22)\n",
      "squeee (27, 22)\n",
      "reshape to four dimensions:  (1, 27, 22, 1)\n",
      "result (1, 58, 48, 1)\n",
      "after change shape: (58, 48)\n",
      "mean shape (1, 58, 48)\n",
      "squeee (58, 48)\n",
      "reshape to four dimensions:  (1, 58, 48, 1)\n",
      "result (1, 120, 100, 1)\n",
      "after change shape: (120, 100)\n",
      "np.final_visualisation_mask! 6331.566\n",
      "(3, 2)\n",
      "mean shape (1, 3, 2)\n",
      "squeee (3, 2)\n",
      "reshape to four dimensions:  (1, 3, 2, 1)\n",
      "result (1, 5, 4, 1)\n",
      "after change shape: (5, 4)\n",
      "mean shape (1, 5, 4)\n",
      "squeee (5, 4)\n",
      "reshape to four dimensions:  (1, 5, 4, 1)\n",
      "result (1, 12, 9, 1)\n",
      "after change shape: (12, 9)\n",
      "mean shape (1, 12, 9)\n",
      "squeee (12, 9)\n",
      "reshape to four dimensions:  (1, 12, 9, 1)\n",
      "result (1, 27, 22, 1)\n",
      "after change shape: (27, 22)\n",
      "mean shape (1, 27, 22)\n",
      "squeee (27, 22)\n",
      "reshape to four dimensions:  (1, 27, 22, 1)\n",
      "result (1, 58, 48, 1)\n",
      "after change shape: (58, 48)\n",
      "mean shape (1, 58, 48)\n",
      "squeee (58, 48)\n",
      "reshape to four dimensions:  (1, 58, 48, 1)\n",
      "result (1, 120, 100, 1)\n",
      "after change shape: (120, 100)\n",
      "np.final_visualisation_mask! 7730.169\n",
      "(3, 2)\n",
      "mean shape (1, 3, 2)\n",
      "squeee (3, 2)\n",
      "reshape to four dimensions:  (1, 3, 2, 1)\n",
      "result (1, 5, 4, 1)\n",
      "after change shape: (5, 4)\n",
      "mean shape (1, 5, 4)\n",
      "squeee (5, 4)\n",
      "reshape to four dimensions:  (1, 5, 4, 1)\n",
      "result (1, 12, 9, 1)\n",
      "after change shape: (12, 9)\n",
      "mean shape (1, 12, 9)\n",
      "squeee (12, 9)\n",
      "reshape to four dimensions:  (1, 12, 9, 1)\n",
      "result (1, 27, 22, 1)\n",
      "after change shape: (27, 22)\n",
      "mean shape (1, 27, 22)\n",
      "squeee (27, 22)\n",
      "reshape to four dimensions:  (1, 27, 22, 1)\n",
      "result (1, 58, 48, 1)\n",
      "after change shape: (58, 48)\n",
      "mean shape (1, 58, 48)\n",
      "squeee (58, 48)\n",
      "reshape to four dimensions:  (1, 58, 48, 1)\n",
      "result (1, 120, 100, 1)\n",
      "after change shape: (120, 100)\n",
      "np.final_visualisation_mask! 5139.004\n",
      "(3, 2)\n",
      "mean shape (1, 3, 2)\n",
      "squeee (3, 2)\n",
      "reshape to four dimensions:  (1, 3, 2, 1)\n",
      "result (1, 5, 4, 1)\n",
      "after change shape: (5, 4)\n",
      "mean shape (1, 5, 4)\n",
      "squeee (5, 4)\n",
      "reshape to four dimensions:  (1, 5, 4, 1)\n",
      "result (1, 12, 9, 1)\n",
      "after change shape: (12, 9)\n",
      "mean shape (1, 12, 9)\n",
      "squeee (12, 9)\n",
      "reshape to four dimensions:  (1, 12, 9, 1)\n",
      "result (1, 27, 22, 1)\n",
      "after change shape: (27, 22)\n",
      "mean shape (1, 27, 22)\n",
      "squeee (27, 22)\n",
      "reshape to four dimensions:  (1, 27, 22, 1)\n",
      "result (1, 58, 48, 1)\n",
      "after change shape: (58, 48)\n",
      "mean shape (1, 58, 48)\n",
      "squeee (58, 48)\n",
      "reshape to four dimensions:  (1, 58, 48, 1)\n",
      "result (1, 120, 100, 1)\n",
      "after change shape: (120, 100)\n",
      "np.final_visualisation_mask! 5346.551\n",
      "(3, 2)\n",
      "mean shape (1, 3, 2)\n",
      "squeee (3, 2)\n",
      "reshape to four dimensions:  (1, 3, 2, 1)\n",
      "result (1, 5, 4, 1)\n",
      "after change shape: (5, 4)\n",
      "mean shape (1, 5, 4)\n",
      "squeee (5, 4)\n",
      "reshape to four dimensions:  (1, 5, 4, 1)\n",
      "result (1, 12, 9, 1)\n",
      "after change shape: (12, 9)\n",
      "mean shape (1, 12, 9)\n",
      "squeee (12, 9)\n",
      "reshape to four dimensions:  (1, 12, 9, 1)\n",
      "result (1, 27, 22, 1)\n",
      "after change shape: (27, 22)\n",
      "mean shape (1, 27, 22)\n",
      "squeee (27, 22)\n",
      "reshape to four dimensions:  (1, 27, 22, 1)\n",
      "result (1, 58, 48, 1)\n",
      "after change shape: (58, 48)\n",
      "mean shape (1, 58, 48)\n",
      "squeee (58, 48)\n",
      "reshape to four dimensions:  (1, 58, 48, 1)\n",
      "result (1, 120, 100, 1)\n",
      "after change shape: (120, 100)\n",
      "np.final_visualisation_mask! 5182.831\n",
      "(3, 2)\n",
      "mean shape (1, 3, 2)\n",
      "squeee (3, 2)\n",
      "reshape to four dimensions:  (1, 3, 2, 1)\n",
      "result (1, 5, 4, 1)\n",
      "after change shape: (5, 4)\n",
      "mean shape (1, 5, 4)\n",
      "squeee (5, 4)\n",
      "reshape to four dimensions:  (1, 5, 4, 1)\n",
      "result (1, 12, 9, 1)\n",
      "after change shape: (12, 9)\n",
      "mean shape (1, 12, 9)\n",
      "squeee (12, 9)\n",
      "reshape to four dimensions:  (1, 12, 9, 1)\n",
      "result (1, 27, 22, 1)\n",
      "after change shape: (27, 22)\n",
      "mean shape (1, 27, 22)\n",
      "squeee (27, 22)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "reshape to four dimensions:  (1, 27, 22, 1)\n",
      "result (1, 58, 48, 1)\n",
      "after change shape: (58, 48)\n",
      "mean shape (1, 58, 48)\n",
      "squeee (58, 48)\n",
      "reshape to four dimensions:  (1, 58, 48, 1)\n",
      "result (1, 120, 100, 1)\n",
      "after change shape: (120, 100)\n",
      "np.final_visualisation_mask! 5740.557\n",
      "(3, 2)\n",
      "mean shape (1, 3, 2)\n",
      "squeee (3, 2)\n",
      "reshape to four dimensions:  (1, 3, 2, 1)\n",
      "result (1, 5, 4, 1)\n",
      "after change shape: (5, 4)\n",
      "mean shape (1, 5, 4)\n",
      "squeee (5, 4)\n",
      "reshape to four dimensions:  (1, 5, 4, 1)\n",
      "result (1, 12, 9, 1)\n",
      "after change shape: (12, 9)\n",
      "mean shape (1, 12, 9)\n",
      "squeee (12, 9)\n",
      "reshape to four dimensions:  (1, 12, 9, 1)\n",
      "result (1, 27, 22, 1)\n",
      "after change shape: (27, 22)\n",
      "mean shape (1, 27, 22)\n",
      "squeee (27, 22)\n",
      "reshape to four dimensions:  (1, 27, 22, 1)\n",
      "result (1, 58, 48, 1)\n",
      "after change shape: (58, 48)\n",
      "mean shape (1, 58, 48)\n",
      "squeee (58, 48)\n",
      "reshape to four dimensions:  (1, 58, 48, 1)\n",
      "result (1, 120, 100, 1)\n",
      "after change shape: (120, 100)\n",
      "np.final_visualisation_mask! 7553.981\n",
      "(3, 2)\n",
      "mean shape (1, 3, 2)\n",
      "squeee (3, 2)\n",
      "reshape to four dimensions:  (1, 3, 2, 1)\n",
      "result (1, 5, 4, 1)\n",
      "after change shape: (5, 4)\n",
      "mean shape (1, 5, 4)\n",
      "squeee (5, 4)\n",
      "reshape to four dimensions:  (1, 5, 4, 1)\n",
      "result (1, 12, 9, 1)\n",
      "after change shape: (12, 9)\n",
      "mean shape (1, 12, 9)\n",
      "squeee (12, 9)\n",
      "reshape to four dimensions:  (1, 12, 9, 1)\n",
      "result (1, 27, 22, 1)\n",
      "after change shape: (27, 22)\n",
      "mean shape (1, 27, 22)\n",
      "squeee (27, 22)\n",
      "reshape to four dimensions:  (1, 27, 22, 1)\n",
      "result (1, 58, 48, 1)\n",
      "after change shape: (58, 48)\n",
      "mean shape (1, 58, 48)\n",
      "squeee (58, 48)\n",
      "reshape to four dimensions:  (1, 58, 48, 1)\n",
      "result (1, 120, 100, 1)\n",
      "after change shape: (120, 100)\n",
      "np.final_visualisation_mask! 7858.6064\n",
      "(3, 2)\n",
      "mean shape (1, 3, 2)\n",
      "squeee (3, 2)\n",
      "reshape to four dimensions:  (1, 3, 2, 1)\n",
      "result (1, 5, 4, 1)\n",
      "after change shape: (5, 4)\n",
      "mean shape (1, 5, 4)\n",
      "squeee (5, 4)\n",
      "reshape to four dimensions:  (1, 5, 4, 1)\n",
      "result (1, 12, 9, 1)\n",
      "after change shape: (12, 9)\n",
      "mean shape (1, 12, 9)\n",
      "squeee (12, 9)\n",
      "reshape to four dimensions:  (1, 12, 9, 1)\n",
      "result (1, 27, 22, 1)\n",
      "after change shape: (27, 22)\n",
      "mean shape (1, 27, 22)\n",
      "squeee (27, 22)\n",
      "reshape to four dimensions:  (1, 27, 22, 1)\n",
      "result (1, 58, 48, 1)\n",
      "after change shape: (58, 48)\n",
      "mean shape (1, 58, 48)\n",
      "squeee (58, 48)\n",
      "reshape to four dimensions:  (1, 58, 48, 1)\n",
      "result (1, 120, 100, 1)\n",
      "after change shape: (120, 100)\n",
      "np.final_visualisation_mask! 9640.827\n",
      "(3, 2)\n",
      "mean shape (1, 3, 2)\n",
      "squeee (3, 2)\n",
      "reshape to four dimensions:  (1, 3, 2, 1)\n",
      "result (1, 5, 4, 1)\n",
      "after change shape: (5, 4)\n",
      "mean shape (1, 5, 4)\n",
      "squeee (5, 4)\n",
      "reshape to four dimensions:  (1, 5, 4, 1)\n",
      "result (1, 12, 9, 1)\n",
      "after change shape: (12, 9)\n",
      "mean shape (1, 12, 9)\n",
      "squeee (12, 9)\n",
      "reshape to four dimensions:  (1, 12, 9, 1)\n",
      "result (1, 27, 22, 1)\n",
      "after change shape: (27, 22)\n",
      "mean shape (1, 27, 22)\n",
      "squeee (27, 22)\n",
      "reshape to four dimensions:  (1, 27, 22, 1)\n",
      "result (1, 58, 48, 1)\n",
      "after change shape: (58, 48)\n",
      "mean shape (1, 58, 48)\n",
      "squeee (58, 48)\n",
      "reshape to four dimensions:  (1, 58, 48, 1)\n",
      "result (1, 120, 100, 1)\n",
      "after change shape: (120, 100)\n",
      "np.final_visualisation_mask! 9758.143\n",
      "(3, 2)\n",
      "mean shape (1, 3, 2)\n",
      "squeee (3, 2)\n",
      "reshape to four dimensions:  (1, 3, 2, 1)\n",
      "result (1, 5, 4, 1)\n",
      "after change shape: (5, 4)\n",
      "mean shape (1, 5, 4)\n",
      "squeee (5, 4)\n",
      "reshape to four dimensions:  (1, 5, 4, 1)\n",
      "result (1, 12, 9, 1)\n",
      "after change shape: (12, 9)\n",
      "mean shape (1, 12, 9)\n",
      "squeee (12, 9)\n",
      "reshape to four dimensions:  (1, 12, 9, 1)\n",
      "result (1, 27, 22, 1)\n",
      "after change shape: (27, 22)\n",
      "mean shape (1, 27, 22)\n",
      "squeee (27, 22)\n",
      "reshape to four dimensions:  (1, 27, 22, 1)\n",
      "result (1, 58, 48, 1)\n",
      "after change shape: (58, 48)\n",
      "mean shape (1, 58, 48)\n",
      "squeee (58, 48)\n",
      "reshape to four dimensions:  (1, 58, 48, 1)\n",
      "result (1, 120, 100, 1)\n",
      "after change shape: (120, 100)\n",
      "np.final_visualisation_mask! 9689.485\n",
      "(3, 2)\n",
      "mean shape (1, 3, 2)\n",
      "squeee (3, 2)\n",
      "reshape to four dimensions:  (1, 3, 2, 1)\n",
      "result (1, 5, 4, 1)\n",
      "after change shape: (5, 4)\n",
      "mean shape (1, 5, 4)\n",
      "squeee (5, 4)\n",
      "reshape to four dimensions:  (1, 5, 4, 1)\n",
      "result (1, 12, 9, 1)\n",
      "after change shape: (12, 9)\n",
      "mean shape (1, 12, 9)\n",
      "squeee (12, 9)\n",
      "reshape to four dimensions:  (1, 12, 9, 1)\n",
      "result (1, 27, 22, 1)\n",
      "after change shape: (27, 22)\n",
      "mean shape (1, 27, 22)\n",
      "squeee (27, 22)\n",
      "reshape to four dimensions:  (1, 27, 22, 1)\n",
      "result (1, 58, 48, 1)\n",
      "after change shape: (58, 48)\n",
      "mean shape (1, 58, 48)\n",
      "squeee (58, 48)\n",
      "reshape to four dimensions:  (1, 58, 48, 1)\n",
      "result (1, 120, 100, 1)\n",
      "after change shape: (120, 100)\n",
      "np.final_visualisation_mask! 10253.064\n",
      "(3, 2)\n",
      "mean shape (1, 3, 2)\n",
      "squeee (3, 2)\n",
      "reshape to four dimensions:  (1, 3, 2, 1)\n",
      "result (1, 5, 4, 1)\n",
      "after change shape: (5, 4)\n",
      "mean shape (1, 5, 4)\n",
      "squeee (5, 4)\n",
      "reshape to four dimensions:  (1, 5, 4, 1)\n",
      "result (1, 12, 9, 1)\n",
      "after change shape: (12, 9)\n",
      "mean shape (1, 12, 9)\n",
      "squeee (12, 9)\n",
      "reshape to four dimensions:  (1, 12, 9, 1)\n",
      "result (1, 27, 22, 1)\n",
      "after change shape: (27, 22)\n",
      "mean shape (1, 27, 22)\n",
      "squeee (27, 22)\n",
      "reshape to four dimensions:  (1, 27, 22, 1)\n",
      "result (1, 58, 48, 1)\n",
      "after change shape: (58, 48)\n",
      "mean shape (1, 58, 48)\n",
      "squeee (58, 48)\n",
      "reshape to four dimensions:  (1, 58, 48, 1)\n",
      "result (1, 120, 100, 1)\n",
      "after change shape: (120, 100)\n",
      "np.final_visualisation_mask! 10523.43\n",
      "(3, 2)\n",
      "mean shape (1, 3, 2)\n",
      "squeee (3, 2)\n",
      "reshape to four dimensions:  (1, 3, 2, 1)\n",
      "result (1, 5, 4, 1)\n",
      "after change shape: (5, 4)\n",
      "mean shape (1, 5, 4)\n",
      "squeee (5, 4)\n",
      "reshape to four dimensions:  (1, 5, 4, 1)\n",
      "result (1, 12, 9, 1)\n",
      "after change shape: (12, 9)\n",
      "mean shape (1, 12, 9)\n",
      "squeee (12, 9)\n",
      "reshape to four dimensions:  (1, 12, 9, 1)\n",
      "result (1, 27, 22, 1)\n",
      "after change shape: (27, 22)\n",
      "mean shape (1, 27, 22)\n",
      "squeee (27, 22)\n",
      "reshape to four dimensions:  (1, 27, 22, 1)\n",
      "result (1, 58, 48, 1)\n",
      "after change shape: (58, 48)\n",
      "mean shape (1, 58, 48)\n",
      "squeee (58, 48)\n",
      "reshape to four dimensions:  (1, 58, 48, 1)\n",
      "result (1, 120, 100, 1)\n",
      "after change shape: (120, 100)\n",
      "np.final_visualisation_mask! 10316.656\n",
      "(3, 2)\n",
      "mean shape (1, 3, 2)\n",
      "squeee (3, 2)\n",
      "reshape to four dimensions:  (1, 3, 2, 1)\n",
      "result (1, 5, 4, 1)\n",
      "after change shape: (5, 4)\n",
      "mean shape (1, 5, 4)\n",
      "squeee (5, 4)\n",
      "reshape to four dimensions:  (1, 5, 4, 1)\n",
      "result (1, 12, 9, 1)\n",
      "after change shape: (12, 9)\n",
      "mean shape (1, 12, 9)\n",
      "squeee (12, 9)\n",
      "reshape to four dimensions:  (1, 12, 9, 1)\n",
      "result (1, 27, 22, 1)\n",
      "after change shape: (27, 22)\n",
      "mean shape (1, 27, 22)\n",
      "squeee (27, 22)\n",
      "reshape to four dimensions:  (1, 27, 22, 1)\n",
      "result (1, 58, 48, 1)\n",
      "after change shape: (58, 48)\n",
      "mean shape (1, 58, 48)\n",
      "squeee (58, 48)\n",
      "reshape to four dimensions:  (1, 58, 48, 1)\n",
      "result (1, 120, 100, 1)\n",
      "after change shape: (120, 100)\n",
      "np.final_visualisation_mask! 8882.305\n",
      "(3, 2)\n",
      "mean shape (1, 3, 2)\n",
      "squeee (3, 2)\n",
      "reshape to four dimensions:  (1, 3, 2, 1)\n",
      "result (1, 5, 4, 1)\n",
      "after change shape: (5, 4)\n",
      "mean shape (1, 5, 4)\n",
      "squeee (5, 4)\n",
      "reshape to four dimensions:  (1, 5, 4, 1)\n",
      "result (1, 12, 9, 1)\n",
      "after change shape: (12, 9)\n",
      "mean shape (1, 12, 9)\n",
      "squeee (12, 9)\n",
      "reshape to four dimensions:  (1, 12, 9, 1)\n",
      "result (1, 27, 22, 1)\n",
      "after change shape: (27, 22)\n",
      "mean shape (1, 27, 22)\n",
      "squeee (27, 22)\n",
      "reshape to four dimensions:  (1, 27, 22, 1)\n",
      "result (1, 58, 48, 1)\n",
      "after change shape: (58, 48)\n",
      "mean shape (1, 58, 48)\n",
      "squeee (58, 48)\n",
      "reshape to four dimensions:  (1, 58, 48, 1)\n",
      "result (1, 120, 100, 1)\n",
      "after change shape: (120, 100)\n",
      "np.final_visualisation_mask! 9144.0205\n",
      "(3, 2)\n",
      "mean shape (1, 3, 2)\n",
      "squeee (3, 2)\n",
      "reshape to four dimensions:  (1, 3, 2, 1)\n",
      "result (1, 5, 4, 1)\n",
      "after change shape: (5, 4)\n",
      "mean shape (1, 5, 4)\n",
      "squeee (5, 4)\n",
      "reshape to four dimensions:  (1, 5, 4, 1)\n",
      "result (1, 12, 9, 1)\n",
      "after change shape: (12, 9)\n",
      "mean shape (1, 12, 9)\n",
      "squeee (12, 9)\n",
      "reshape to four dimensions:  (1, 12, 9, 1)\n",
      "result (1, 27, 22, 1)\n",
      "after change shape: (27, 22)\n",
      "mean shape (1, 27, 22)\n",
      "squeee (27, 22)\n",
      "reshape to four dimensions:  (1, 27, 22, 1)\n",
      "result (1, 58, 48, 1)\n",
      "after change shape: (58, 48)\n",
      "mean shape (1, 58, 48)\n",
      "squeee (58, 48)\n",
      "reshape to four dimensions:  (1, 58, 48, 1)\n",
      "result (1, 120, 100, 1)\n",
      "after change shape: (120, 100)\n",
      "np.final_visualisation_mask! 10726.758\n",
      "(3, 2)\n",
      "mean shape (1, 3, 2)\n",
      "squeee (3, 2)\n",
      "reshape to four dimensions:  (1, 3, 2, 1)\n",
      "result (1, 5, 4, 1)\n",
      "after change shape: (5, 4)\n",
      "mean shape (1, 5, 4)\n",
      "squeee (5, 4)\n",
      "reshape to four dimensions:  (1, 5, 4, 1)\n",
      "result (1, 12, 9, 1)\n",
      "after change shape: (12, 9)\n",
      "mean shape (1, 12, 9)\n",
      "squeee (12, 9)\n",
      "reshape to four dimensions:  (1, 12, 9, 1)\n",
      "result (1, 27, 22, 1)\n",
      "after change shape: (27, 22)\n",
      "mean shape (1, 27, 22)\n",
      "squeee (27, 22)\n",
      "reshape to four dimensions:  (1, 27, 22, 1)\n",
      "result (1, 58, 48, 1)\n",
      "after change shape: (58, 48)\n",
      "mean shape (1, 58, 48)\n",
      "squeee (58, 48)\n",
      "reshape to four dimensions:  (1, 58, 48, 1)\n",
      "result (1, 120, 100, 1)\n",
...

This file has been truncated, please download it to see its full contents.

Credits

Weiyu Peng

Weiyu Peng

24 projects • 11 followers

Comments