{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import os\n", "from os.path import join\n", "import sys\n", "from pathlib import Path\n", "\n", "import numpy as np\n", "import pandas as pd\n", "\n", "from PIL import Image\n", "import cv2 as cv" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "fp_attr = '/data_store_hdd/datasets/people/megaface/metadata/face_attributes.csv'" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "df = pd.read_csv(fp_attr)" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
indexage_apparentage_realfmroi_index
0011.0518.630.81550.18450
1128.5926.640.02190.97811
2212.0919.080.68080.31922
3339.3651.360.99430.00573
4441.8452.250.82260.17744
\n", "
" ], "text/plain": [ " index age_apparent age_real f m roi_index\n", "0 0 11.05 18.63 0.8155 0.1845 0\n", "1 1 28.59 26.64 0.0219 0.9781 1\n", "2 2 12.09 19.08 0.6808 0.3192 2\n", "3 3 39.36 51.36 0.9943 0.0057 3\n", "4 4 41.84 52.25 0.8226 0.1774 4" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df.head()" ] }, { "cell_type": "code", "execution_count": 21, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Less than 21yr: 311,973 (apparent), 168,619 (real)\n", "Less than 18yr: 175,628 (apparent), 53,602 (real)\n", "Less than 12yr: 35,235 (apparent), 773 (real)\n", "Less than 8yr: 1,488 (apparent), 0 (real)\n" ] } ], "source": [ "brackets = [21, 18, 12, 8]\n", "for b in brackets:\n", " age_ap = len(df[df['age_apparent'] < b])\n", " age_real = len(df[df['age_real'] < b])\n", " print(f\"Less than {b}yr: {age_ap:,} (apparent), {age_real:,} (real)\")" ] }, { "cell_type": "code", "execution_count": 22, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "1559780" ] }, "execution_count": 22, "metadata": {}, "output_type": "execute_result" } ], "source": [ "len(df)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "megapixels", "language": "python", "name": "megapixels" }, "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.8" } }, "nbformat": 4, "nbformat_minor": 2 }