{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# UCCS Visualize\n", "\n", "- read in all images, resized\n", "- mean images\n", "- read in all bboxes\n", "- draw normalized bboxes" ] }, { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "%reload_ext autoreload\n", "%autoreload 2\n", "\n", "import os\n", "from os.path import join\n", "import math\n", "from glob import glob\n", "from random import randint\n", "\n", "import cv2 as cv\n", "import numpy as np\n", "import pandas as pd\n", "from PIL import Image, ImageDraw\n", "%matplotlib inline\n", "import matplotlib.pyplot as plt\n", "import scipy.io\n", "from pathlib import Path\n", "from sklearn import preprocessing\n", "from tqdm import tqdm_notebook as tqdm\n", "\n", "import sys\n", "sys.path.append('/work/megapixels_dev/megapixels/')\n", "from app.settings import app_cfg as cfg\n", "from app.utils import file_utils, im_utils\n", "from app.models.bbox import BBox" ] }, { "cell_type": "code", "execution_count": 30, "metadata": {}, "outputs": [], "source": [ "fp_dir_uccs = '/data_store/datasets/people/uccs/dataset'\n", "fp_dir_ims = '/data_store_ssd/datasets/people/uccs/media/original/'\n", "fp_baseline = '/data_store/datasets/people/uccs/dataset/UCCS-v2-detection-baseline-validation.csv'\n", "fp_out_bboxes = '/data_store/datasets/people/uccs/processed/uccs_bboxes_white_01.png'\n", "fp_out_mean = '/data_store/datasets/people/uccs/processed/uccs_mean.png'" ] }, { "cell_type": "code", "execution_count": 31, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "16149 images\n" ] } ], "source": [ "fp_ims = glob(join(fp_dir_ims, '*.jpg'))\n", "print(len(fp_ims), 'images')" ] }, { "cell_type": "code", "execution_count": 33, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "(3456, 5184, 3)\n" ] } ], "source": [ "im = cv.imread(fp_ims[0])\n", "print(im.shape)" ] }, { "cell_type": "code", "execution_count": 46, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
| \n", " | FILE | \n", "BB_X | \n", "BB_Y | \n", "BB_WIDTH | \n", "BB_HEIGHT | \n", "DETECTION_SCORE | \n", "
|---|---|---|---|---|---|---|
| 0 | \n", "000b35e2c91ccd4adb25e7e410db7b7c.jpg | \n", "3540.81 | \n", "1973.13 | \n", "237.21 | \n", "287.37 | \n", "0.99 | \n", "
| 1 | \n", "000b35e2c91ccd4adb25e7e410db7b7c.jpg | \n", "1576.59 | \n", "2290.10 | \n", "189.79 | \n", "223.13 | \n", "0.97 | \n", "
| 2 | \n", "000b35e2c91ccd4adb25e7e410db7b7c.jpg | \n", "706.63 | \n", "1512.31 | \n", "180.06 | \n", "254.76 | \n", "0.55 | \n", "
| 3 | \n", "000d7f5f2b753210388273e792dae92b.jpg | \n", "2106.86 | \n", "2868.81 | \n", "226.57 | \n", "279.73 | \n", "1.00 | \n", "
| 4 | \n", "000d7f5f2b753210388273e792dae92b.jpg | \n", "-17.83 | \n", "1933.80 | \n", "125.03 | \n", "214.81 | \n", "1.00 | \n", "