diff options
Diffstat (limited to 'megapixels/notebooks/_local_scratch.ipynb')
| -rw-r--r-- | megapixels/notebooks/_local_scratch.ipynb | 202 |
1 files changed, 0 insertions, 202 deletions
diff --git a/megapixels/notebooks/_local_scratch.ipynb b/megapixels/notebooks/_local_scratch.ipynb deleted file mode 100644 index cee17cba..00000000 --- a/megapixels/notebooks/_local_scratch.ipynb +++ /dev/null @@ -1,202 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "metadata": {}, - "source": [ - "# Scratch pad" - ] - }, - { - "cell_type": "code", - "execution_count": 1, - "metadata": {}, - "outputs": [], - "source": [ - "from glob import glob\n", - "from os.path import join\n", - "from pathlib import Path\n", - "import random\n", - "\n", - "import pandas as pd\n", - "import cv2 as cv\n", - "import numpy as np\n", - "%matplotlib inline\n", - "import matplotlib.pyplot as plt\n", - "\n", - "import sys\n", - "sys.path.append('/work/megapixels_dev/megapixels')\n", - "from app.models.bbox import BBox\n", - "from app.utils import im_utils, file_utils" - ] - }, - { - "cell_type": "code", - "execution_count": 5, - "metadata": {}, - "outputs": [], - "source": [ - "a= [1]" - ] - }, - { - "cell_type": "code", - "execution_count": 6, - "metadata": {}, - "outputs": [ - { - "data": { - "text/plain": [ - "1" - ] - }, - "execution_count": 6, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "a[-1]" - ] - }, - { - "cell_type": "code", - "execution_count": 32, - "metadata": {}, - "outputs": [], - "source": [ - "fp_filepath = '/data_store_ssd/datasets/people/lfw/metadata/filepath.csv'\n", - "df_filepath = pd.read_csv(fp_filepath)" - ] - }, - { - "cell_type": "code", - "execution_count": 48, - "metadata": {}, - "outputs": [], - "source": [ - "image_index = 12467" - ] - }, - { - "cell_type": "code", - "execution_count": 55, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "12474\n" - ] - }, - { - "data": { - "text/plain": [ - "index 12851\n", - "ext jpg\n", - "fn Vladimir_Putin_0029\n", - "subdir Vladimir_Putin\n", - "Name: 12474, dtype: object" - ] - }, - "execution_count": 55, - "metadata": {}, - "output_type": "execute_result" - } - ], - "source": [ - "image_index += 1\n", - "print(image_index)\n", - "df_filepath.iloc[image_index]" - ] - }, - { - "cell_type": "code", - "execution_count": 56, - "metadata": {}, - "outputs": [], - "source": [ - "import imutils" - ] - }, - { - "cell_type": "code", - "execution_count": 57, - "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Help on function build_montages in module imutils.convenience:\n", - "\n", - "build_montages(image_list, image_shape, montage_shape)\n", - " ---------------------------------------------------------------------------------------------\n", - " author: Kyle Hounslow\n", - " ---------------------------------------------------------------------------------------------\n", - " Converts a list of single images into a list of 'montage' images of specified rows and columns.\n", - " A new montage image is started once rows and columns of montage image is filled.\n", - " Empty space of incomplete montage images are filled with black pixels\n", - " ---------------------------------------------------------------------------------------------\n", - " :param image_list: python list of input images\n", - " :param image_shape: tuple, size each image will be resized to for display (width, height)\n", - " :param montage_shape: tuple, shape of image montage (width, height)\n", - " :return: list of montage images in numpy array format\n", - " ---------------------------------------------------------------------------------------------\n", - " \n", - " example usage:\n", - " \n", - " # load single image\n", - " img = cv2.imread('lena.jpg')\n", - " # duplicate image 25 times\n", - " num_imgs = 25\n", - " img_list = []\n", - " for i in xrange(num_imgs):\n", - " img_list.append(img)\n", - " # convert image list into a montage of 256x256 images tiled in a 5x5 montage\n", - " montages = make_montages_of_images(img_list, (256, 256), (5, 5))\n", - " # iterate through montages and display\n", - " for montage in montages:\n", - " cv2.imshow('montage image', montage)\n", - " cv2.waitKey(0)\n", - " \n", - " ----------------------------------------------------------------------------------------------\n", - "\n" - ] - } - ], - "source": [ - "help(imutils.build_montages)" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "metadata": {}, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python [conda env:megapixels]", - "language": "python", - "name": "conda-env-megapixels-py" - }, - "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.6" - } - }, - "nbformat": 4, - "nbformat_minor": 2 -} |
