From 93855b2faf8b795d0058c217ee980d435f23227d Mon Sep 17 00:00:00 2001 From: natanielruiz <nataniel777@hotmail.com> Date: 星期四, 14 九月 2017 08:54:14 +0800 Subject: [PATCH] Training on AFLW with different yaw loss multipliers --- practice/.ipynb_checkpoints/create_filtered_datasets-checkpoint.ipynb | 61 ++++++++++++++++++++++++++++++ 1 files changed, 60 insertions(+), 1 deletions(-) diff --git a/practice/.ipynb_checkpoints/create_filtered_datasets-checkpoint.ipynb b/practice/.ipynb_checkpoints/create_filtered_datasets-checkpoint.ipynb index f564f74..970dcc7 100644 --- a/practice/.ipynb_checkpoints/create_filtered_datasets-checkpoint.ipynb +++ b/practice/.ipynb_checkpoints/create_filtered_datasets-checkpoint.ipynb @@ -2,7 +2,7 @@ "cells": [ { "cell_type": "code", - "execution_count": null, + "execution_count": 6, "metadata": { "collapsed": true }, @@ -93,6 +93,65 @@ " \n", " print counter" ] + }, + { + "cell_type": "code", + "execution_count": 10, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [ + "AFLW = '/Data/nruiz9/data/facial_landmarks/AFLW/aflw_cropped_loose/'\n", + "filenames = '/Data/nruiz9/data/facial_landmarks/AFLW/aflw_cropped_loose/filename_list.txt'" + ] + }, + { + "cell_type": "code", + "execution_count": 12, + "metadata": { + "collapsed": false + }, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "601\n" + ] + } + ], + "source": [ + "fid = open(filenames, 'r')\n", + "out = open(os.path.join(AFLW, 'filename_list_filtered.txt'), 'wb')\n", + "counter = 0\n", + "for line in fid:\n", + " original_line = line\n", + " line = line.strip('\\n')\n", + " if not os.path.exists(os.path.join(AFLW, line + '.txt')):\n", + " counter += 1\n", + " continue\n", + " annot_file = open(os.path.join(AFLW, line + '.txt'))\n", + " annot = annot_file.readline().strip('\\n').split(' ')\n", + " yaw = float(annot[1]) * 180 / np.pi\n", + " pitch = float(annot[2]) * 180 / np.pi\n", + " roll = float(annot[3]) * 180 / np.pi\n", + " if abs(pitch) > 89 or abs(yaw) > 89 or abs(roll) > 89:\n", + " counter += 1\n", + " continue\n", + " out.write(original_line)\n", + "\n", + "print counter " + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": { + "collapsed": true + }, + "outputs": [], + "source": [] } ], "metadata": { -- Gitblit v1.8.0