|
19 | 19 | },
|
20 | 20 | {
|
21 | 21 | "cell_type": "code",
|
22 |
| - "execution_count": null, |
| 22 | + "execution_count": 1, |
23 | 23 | "metadata": {},
|
24 |
| - "outputs": [], |
| 24 | + "outputs": [ |
| 25 | + { |
| 26 | + "name": "stdout", |
| 27 | + "output_type": "stream", |
| 28 | + "text": [ |
| 29 | + "WARNING:tensorflow:From D:\\Almaatech\\face\\face-quality-metrics\\detection\\mtcnn\\detect_face.py:210: calling reduce_max (from tensorflow.python.ops.math_ops) with keep_dims is deprecated and will be removed in a future version.\n", |
| 30 | + "Instructions for updating:\n", |
| 31 | + "keep_dims is deprecated, use keepdims instead\n", |
| 32 | + "WARNING:tensorflow:From D:\\Almaatech\\face\\face-quality-metrics\\detection\\mtcnn\\detect_face.py:212: calling reduce_sum (from tensorflow.python.ops.math_ops) with keep_dims is deprecated and will be removed in a future version.\n", |
| 33 | + "Instructions for updating:\n", |
| 34 | + "keep_dims is deprecated, use keepdims instead\n" |
| 35 | + ] |
| 36 | + } |
| 37 | + ], |
25 | 38 | "source": [
|
26 | 39 | "import tensorflow as tf\n",
|
27 | 40 | "from detection.mtcnn import detect_face\n",
|
|
32 | 45 | },
|
33 | 46 | {
|
34 | 47 | "cell_type": "code",
|
35 |
| - "execution_count": null, |
| 48 | + "execution_count": 2, |
36 | 49 | "metadata": {},
|
37 | 50 | "outputs": [],
|
38 | 51 | "source": [
|
|
47 | 60 | },
|
48 | 61 | {
|
49 | 62 | "cell_type": "code",
|
50 |
| - "execution_count": null, |
| 63 | + "execution_count": 3, |
51 | 64 | "metadata": {},
|
52 | 65 | "outputs": [],
|
53 | 66 | "source": [
|
|
69 | 82 | "# Illumination "
|
70 | 83 | ]
|
71 | 84 | },
|
72 |
| - { |
73 |
| - "cell_type": "code", |
74 |
| - "execution_count": null, |
75 |
| - "metadata": {}, |
76 |
| - "outputs": [], |
77 |
| - "source": [ |
78 |
| - "points" |
79 |
| - ] |
80 |
| - }, |
81 | 85 | {
|
82 | 86 | "cell_type": "code",
|
83 | 87 | "execution_count": null,
|
|
146 | 150 | "cell_type": "markdown",
|
147 | 151 | "metadata": {},
|
148 | 152 | "source": [
|
149 |
| - "# Facial symmetry" |
| 153 | + "# Facial Symmetry" |
150 | 154 | ]
|
151 | 155 | },
|
152 | 156 | {
|
153 | 157 | "cell_type": "code",
|
154 |
| - "execution_count": null, |
| 158 | + "execution_count": 4, |
155 | 159 | "metadata": {},
|
156 | 160 | "outputs": [],
|
157 | 161 | "source": [
|
158 | 162 | "from skimage.feature import hog\n",
|
159 | 163 | "\n",
|
160 | 164 | "def symmetry(img, landmark, bounding_box):\n",
|
161 |
| - " x1, y1, x2, y2 = int(bounding_box[0]), int(bounding_box[1]), int(bounding_box[2]), int(bounding_box[3])\n", |
| 165 | + " x1, y1, x2, y2 = int(min(bounding_box[0], min(landmark[:5]))), \\\n", |
| 166 | + " int(min(bounding_box[1], min(landmark[5:]))), \\\n", |
| 167 | + " int(max(bounding_box[2], max(landmark[:5]))), \\\n", |
| 168 | + " int(max(bounding_box[3], max(landmark[5:])))\n", |
162 | 169 | " \n",
|
163 | 170 | " landmark = np.array([[landmark[i], landmark[5 + i]] for i in range(5)], np.int32).reshape((-1,1,2))\n",
|
164 | 171 | " contour = landmark[:, 0] - [[x1, y1]]\n",
|
|
181 | 188 | },
|
182 | 189 | {
|
183 | 190 | "cell_type": "code",
|
184 |
| - "execution_count": null, |
| 191 | + "execution_count": 5, |
185 | 192 | "metadata": {},
|
186 |
| - "outputs": [], |
| 193 | + "outputs": [ |
| 194 | + { |
| 195 | + "name": "stderr", |
| 196 | + "output_type": "stream", |
| 197 | + "text": [ |
| 198 | + "c:\\users\\bahar\\appdata\\local\\programs\\python\\python35\\lib\\site-packages\\skimage\\feature\\_hog.py:150: skimage_deprecation: Default value of `block_norm`==`L1` is deprecated and will be changed to `L2-Hys` in v0.15. To supress this message specify explicitly the normalization method.\n", |
| 199 | + " skimage_deprecation)\n" |
| 200 | + ] |
| 201 | + }, |
| 202 | + { |
| 203 | + "data": { |
| 204 | + "text/plain": [ |
| 205 | + "0.02465394288301468" |
| 206 | + ] |
| 207 | + }, |
| 208 | + "execution_count": 5, |
| 209 | + "metadata": {}, |
| 210 | + "output_type": "execute_result" |
| 211 | + } |
| 212 | + ], |
187 | 213 | "source": [
|
188 | 214 | "symmetry(img, points, bounding_boxes[0])"
|
189 | 215 | ]
|
|
197 | 223 | },
|
198 | 224 | {
|
199 | 225 | "cell_type": "code",
|
200 |
| - "execution_count": null, |
| 226 | + "execution_count": 6, |
201 | 227 | "metadata": {},
|
202 | 228 | "outputs": [],
|
203 | 229 | "source": [
|
|
216 | 242 | },
|
217 | 243 | {
|
218 | 244 | "cell_type": "code",
|
219 |
| - "execution_count": null, |
| 245 | + "execution_count": 7, |
220 | 246 | "metadata": {},
|
221 |
| - "outputs": [], |
| 247 | + "outputs": [ |
| 248 | + { |
| 249 | + "data": { |
| 250 | + "text/plain": [ |
| 251 | + "1" |
| 252 | + ] |
| 253 | + }, |
| 254 | + "execution_count": 7, |
| 255 | + "metadata": {}, |
| 256 | + "output_type": "execute_result" |
| 257 | + } |
| 258 | + ], |
222 | 259 | "source": [
|
223 | 260 | "size(img)"
|
224 | 261 | ]
|
| 262 | + }, |
| 263 | + { |
| 264 | + "cell_type": "code", |
| 265 | + "execution_count": null, |
| 266 | + "metadata": {}, |
| 267 | + "outputs": [], |
| 268 | + "source": [] |
225 | 269 | }
|
226 | 270 | ],
|
227 | 271 | "metadata": {
|
|
0 commit comments