-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcodeVersionCurrProj.rst.bckp
607 lines (390 loc) · 19.5 KB
/
codeVersionCurrProj.rst.bckp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
Attribute specific models
#########################
References
~~~~~~~~~~
- Paper links:
- https://ieeexplore.ieee.org/document/8361884
- https://link.springer.com/article/10.1007/s11263-020-01308-z
- Papers bookmarked under [email protected] @Researcer.com https://www.researcher-app.com/library
- Check other links @list
Approach
~~~~~~~~
- **Get a attribute labelled dataset**. And to that extent found CelebA dataset. Dataset description:
- Has 40 attributes, such as spectacles, moustache, goatee, big-nose, blonde, black hair, big lips and so on.
- There are about 10k different identities 'spread across' 40 attribute. So for a given attribute on a average there about 5k identities.
- **Find a baseline classifier of these attributes**. Found https://github.com/d-li14/face-attribute-prediction which has 92% accuracy on attribute classification. *This attribute classification is expected to predict/infer the attribute given an image*
- This is a Resnet 50 network and I have trained it in hourse and reproduced the accuracies.
- **Train attribute specific Resnet classifier**. Created a feature specific dataset and Trained Resnet (pretrained on VGG facenet) through **finetuning**
- Wrote a python script to separate all the images per attribute, and further separted into identities. I.e. Person1 and Person2, with Attribute A1 and attribute A2, will now be in a folder strcutre as follows:
- A1
- Person1
- Person2
- A2
- Person1
- Person2
- Trained Resnet classifier by fine tuning for all identities (person1, person2) for each attribute. I.e. first with A1; then another model for A2 etc
- **Analysis**:
- Approach:
- First train on all identities which at-least 20 images. Thus found about 530 identities. And found classfiication accuracy on these. Please note that unlike normal face datasets here the variations in attributes is very high. This gave accuracy of about 66% with RESNET pretrained network.
- Then trained on individual attributes for same number of identities i.e. about 530 identities who have a sizeable (> 20 images); and thn compared against the former.
- **Observations**
- **Without specific attribute**: Accuracy plot below:
.. image:: ./myImages/proj/poseInvariant.png
:scale: 75 %
:align: center
- **Bangs** and **Blonde hair** : Found that attribute specific classification is working to give more accuracy especially if the attribute is not too disturbing. Such as hair glasses. These gave similar accuracy of 66%
.. _bangs:
- Bangs
.. image:: ./myImages/proj/bangs_mtcnn.png
:scale: 75 %
:align: center
.. image:: ./myImages/proj/bangs_accuracy.png
:scale: 75 %
:align: center
- Blonde hair
.. image:: ./myImages/proj/blonde_hair_mtcnn.png
:scale: 75 %
:align: center
.. image:: ./myImages/proj/blonde_hair_accuracy.png
:scale: 75 %
:align: center
- **Eye bags** and **Big nose** gave high accuracy of 81% ,wondering if it could be because the features are not as intrusive/obstructive
.. _eyeBags:
- Eye Bags
.. image:: ./myImages/proj/specificPose_eyeBags_mtcnn.png
:scale: 75 %
:align: center
.. image:: ./myImages/proj/specificPose_eyeBags_accuracy.png
:scale: 75 %
:align: center
- Big nose
.. image:: ./myImages/proj/big_nose_mtcnn.png
:scale: 75 %
:align: center
.. image:: ./myImages/proj/big_nose_accuracy.png
:scale: 75 %
:align: center
- Work in progress...
- **Additional Attempts**:
- Tried all of the above, without finetuning, and instead by getting a fixed-length 512 size Facenet embedding, and then running classifiers using simple SVM on SK-Learn. The results there too are comparable.
Evaluation
~~~~~~~~~~
- Attempt related to Genuine-Impostor calculation:
- Plotted genuine impostor scores for specific features.
- Feature1 - :ref:`Eyebags <eyeBags>` ( These are obscure features, which is as good as a normal face). Accuracy is shown as **98%**
- Feature2 - :ref:`Bangs <bangs>` (These are prominent features, but even this the accuracy is shows as **90%**
- *The accuracy numbers presented above are much better when compared to classify within a class using a classifier.*
- Therefore wrote a python based API (using help of some github resources) to formalize a standard Genuine-Impostor code, with the core logic as follows:
- Form pairs of images with the similar/impostor label (say, 200 images pairs with 100 labels therefore)
- Get a simiarilty score between the pairs, to now form a mapping between similarity score and actual label.
- Create K-fold suffles of these (say for a given K)
- Create a range of threshold values
- Move the threshold through the fold to get TPR/FPR and also get the thresold with best accuracy.
- The above is additionally worked on by splitting the training and testing.
Attributes considered as prominent:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Following attributes are considered by the approach defined as follows:
Below the attributes considered by CelebA dataset. I have marked the prominent features, each of which I plan to create a separate bin for, while all the non-prominent ones will fall into another bin. Some features such as hair type (bald, black, brown) I am not considering as prominent because it is cutout by the MTCNN detector
- 5_o_Clock_Shadow
- Arched_Eyebrows
- Attractive
- Bags_Under_Eyes
- Bald
- Bangs ------------->Prominent
- Big_Lips
- Big_Nose
- Black_Hair
- Blond_Hair
- Blurry
- Brown_Hair
- Bushy_Eyebrows
- Chubby
- Double_Chin
- Eyeglasses -------->Prominent
- Goatee------------->Prominent
- Gray_Hair
- Heavy_Makeup
- High_Cheekbones
- Male
- Mouth_Slightly_Open
- Mustache----------->Proiminent
- Narrow_Eyes
- No_Beard
- Oval_Face
- Pale_Skin
- Pointy_Nose
- Receding_Hairline
- Rosy_Cheeks
- Sideburns ---------->Prominent but consusmed by Goatee..so no separate folder needed (helps in 'not' prominent binning of data)
- Smiling ---------->Prominent
- Straight_Hair
- Wavy_Hair
- Wearing_Earrings
- Wearing_Hat
- Wearing_Lipstick
- Wearing_Necklace
- Wearing_Necktie
- Young
Experiment Jun 2020:
~~~~~~~~~~~~~~~~~~~~
- The objective here is to split Gallery and Probe such that for a given class and 5 attributes(*Bangs,Mustache,Goatee,Smile,Eyeglasses*):
- Gallery and probe contain images **without any specific attributes** any specific attribute.
- Gallery and probe contain images **with specific attributes**
- Gallery **without any specific attribute** and probe **with specific attributes**
| P1 -> Probe=Gallery=No Attribute
| P2 -> Probe=Gallery=Attribute Present
| P3 -> Probe=Attribute, Gallery=No Attribute
=============== =============== =================== ================== ================ ===========
Attribute State Genuine/Imposter ImgCount/Classes Verification Acc Threshold
=============== =============== =================== ================== ================ ===========
Normal P1 100/100 6197/563 0.915 1.196
Eyeglasses P2 100/100 620/189 0.94 1.146
.......... P3 100/100 620/189 0.93 1.43
Goatee P2 100/100 720/90 0.93 1.1098
.......... P3 100/100 720/90 0.93 1.43
Mustache P2 100/100 523/70 0.90 1.1099
.......... P3 100/100 523/70 0.93 1.43
Sideburns P2 100/100 676/80 0.93 1.1018
.......... P3 100/100 676/80 0.879 1.32
Bangs P2 100/100 2520/364 0.92 1.3
.......... P3 100/100 2520/364 0.90 1.31
Smiling P2 100/100 6993/567 0.93 1.118
.......... P3 100/100 6993/567 0.879 1.188
=============== =============== =================== ================== ================ ===========
- Sample image per class of each of the above:
Eyeglasses
.. image:: ./myImages/proj/EyeGlasses.jpg
:scale: 50 %
:align: center
Goatee
.. image:: ./myImages/proj/Goatee.jpg
:scale: 50 %
:align: center
Mustache
.. image:: ./myImages/proj/Mustache.jpg
:scale: 50 %
:align: center
Sideburns (Face detector obscuring the feature)
.. image:: ./myImages/proj/Sideburns.jpg
:scale: 50 %
:align: center
Smiling
.. image:: ./myImages/proj/Smiling.jpg
:scale: 50 %
:align: center
Experiment 19 Jun 2020
~~~~~~~~~~~~~~~~~~~~~~
**Objective:** Remove "normal" images which don't have any "prominent" feature counter parts. And then increase genuine impostor pair to 200/200 instead of 100/100 and report the same results as above:
1)Removal of normal: Found only the following two classes have "normal" images with no counterpart on any other "prominent" features:
| 105
| 263
2)For 400/200 and 200/200 Genuine/Impostor pair
| P1 -> Probe=Gallery=No Attribute
| P2 -> Probe=Gallery=Attribute Present
| P3 -> Probe=Attribute, Gallery=No Attribute
.. _PairsTable:
.. csv-table:: Results upto 1500 pairs.
:file: ./mycsvsheets/SimilarityDiff.csv
:header-rows: 1
Experiment 24 Jun 2020
~~~~~~~~~~~~~~~~~~~~~~
**Objectives:**
- increase Sample size to 1500 (updated in the PairsTable_ above)
- Analyze the **normal** class to get a sense of the variations. Images below: NOTE point below:
- Please right-click and View Image to expand for a closer look
- Each row is mostly a single class. Sometimes overflowing to the next row.
- There is no signifcance of each image (separated by huge space); they are just 6 individual screenshots
.. image:: ./myImages/proj/Normal1.png
:align: center
.. image:: ./myImages/proj/Normal2.png
:align: center
.. image:: ./myImages/proj/Normal3.png
:align: center
.. image:: ./myImages/proj/Normal4.png
:align: center
.. image:: ./myImages/proj/Normal5.png
:align: center
.. image:: ./myImages/proj/Normal6.png
:align: center
.. image:: ./myImages/proj/Normal7.png
:align: center
.. image:: ./myImages/proj/Normal8.png
:align: center
25 Jun 2020: Updated sampler class distribution
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- Classes picked up by the random samples, for both probe and gallery having attribute
Total available classes for Bangs: 364
.. |att_class_count1| image:: ./myImages/proj/plot_Bangs_both_attr.png
:width: 45%
Total available classes for Goatee: 90
.. |att_class_count2| image:: ./myImages/proj/plot_Goatee_both_attr.png
:width: 45%
Total available classes for Mustache: 70
.. |att_class_count3| image:: ./myImages/proj/plot_Mustache_both_attr.png
:width: 45%
Total available classes for Sideburns: 80
.. |att_class_count4| image:: ./myImages/proj/plot_Sideburns_both_attr.png
:width: 45%
Total available classes for Eyeclasses: 189
.. |att_class_count5| image:: ./myImages/proj/plot_Eyeglasses_both_attr.png
:width: 45%
|att_class_count1| |att_class_count2| |att_class_count3| |att_class_count4| |att_class_count5|
- Classes picked by random samples, for probe having attr and gallery not having attr
.. |class_count1| image:: ./myImages/proj/plot_Bangs_noattr_attr.png
:width: 45%
.. |class_count2| image:: ./myImages/proj/plot_Goatee_noattr_attr.png
:width: 45%
.. |class_count3| image:: ./myImages/proj/plot_Mustache_noattr_attr.png
:width: 45%
.. |class_count4| image:: ./myImages/proj/plot_Sideburns_noattr_attr.png
:width: 45%
.. |class_count5| image:: ./myImages/proj/plot_Eyeglasses_noattr_attr.png
:width: 45%
|class_count1| |class_count2| |class_count3| |class_count4| |class_count5|
25 Jun 2020: Comparative ROC with xscale for Diff Vs Same gall-probe
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This location has all the images used to craw the analysis below; about prominent 517 samples
(base) arun.subramanian@node01:/scratch/arunScratch/person_recognition/FaceAttribute/dataset/splitFolderBasedOnFeat/probeGalldiffImages$
Images are from the following location:
(base) arun.subramanian@node01:/scratch/arunScratch/person_recognition/FaceAttribute/dataset/splitFolderBasedOnFeat/biometrics_scores$
- **Eyeglasses** (Left graph is scaled)
|pic1| |pic2|
.. |pic1| image:: ./myImages/proj/DualROC_EyeGlasses.jpeg
:width: 45%
.. |pic2| image:: ./myImages/proj/NoScale_DualROC_EyeGlasses.jpeg
:width: 45%
- **Bangs** (Left graph is scaled)
|pic10| |pic20|
.. |pic10| image:: ./myImages/proj/DualROC_Bangs.jpeg
:width: 45%
.. |pic20| image:: ./myImages/proj/NoScale_DualROC_Bangs.jpeg
:width: 45%
- **Smiling** (Left graph is scaled)
|pic11| |pic21|
.. |pic11| image:: ./myImages/proj/DualROC_Smiling.jpeg
:width: 45%
.. |pic21| image:: ./myImages/proj/NoScale_DualROC_Smiling.jpeg
:width: 45%
- **Goatee** (Left graph is scaled)
|pic12| |pic22|
.. |pic12| image:: ./myImages/proj/DualROC_Goatee.jpeg
:width: 45%
.. |pic22| image:: ./myImages/proj/NoScale_DualROC_Goatee.jpeg
:width: 45%
- **Mustache** (Left graph is scaled)
|pic13| |pic23|
.. |pic13| image:: ./myImages/proj/DualROC_Mustache.jpeg
:width: 45%
.. |pic23| image:: ./myImages/proj/NoScale_DualROC_Mustache.jpeg
:width: 45%
- **Sideburns** (Left graph is scaled)
|pic14| |pic24|
.. |pic14| image:: ./myImages/proj/DualROC_Sideburns.jpeg
:width: 45%
.. |pic24| image:: ./myImages/proj/NoScale_DualROC_Sideburns.jpeg
:width: 45%
30 JUN 2020: Attribute detector confidence histogram
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| The x-axis below shows the "confidence" value (not-normalized)
| The y-value shows the normalized number of images displaying that binned confidence
| **Please click on the images to enlarge**
The following plots are a second attempt; the approach is, for a given attribute, get all the confidence values where the label is 0, and confidence values where label is 1, and plot those confidence scored. The code is simplified too
The code/images present in image names of form Eyeglasses_sns_histOnes.png at the location: **/home/arun.subramanian/ArunFolderBIOSID/faceAttention/faceAttributeClassification/face-attribute-prediction/confidencePlot/images**
Files used:
Location: **/home/arun.subramanian/ArunFolderBIOSID/faceAttention/faceAttributeClassification/face-attribute-prediction/confidencePlot**
- a1_amazingCovertPalatable.py
- a2_readingFromArray_and_all_analysis.py
|adb1| |adb2| |adb3| |adb4| |adb5| |adb6|
.. |adb1| image:: ./myImages/proj/SampleCount_Eyeglasses_sns_histOnes.png
:width: 45%
.. |adb2| image:: ./myImages/proj/SampleCount_Smiling_sns_histOnes.png
:width: 45%
.. |adb3| image:: ./myImages/proj/SampleCount_Bangs_sns_histOnes.png
:width: 45%
.. |adb4| image:: ./myImages/proj/SampleCount_Goatee_sns_histOnes.png
:width: 45%
.. |adb5| image:: ./myImages/proj/SampleCount_Sideburns_sns_histOnes.png
:width: 45%
.. |adb6| image:: ./myImages/proj/SampleCount_Mustache_sns_histOnes.png
:width: 45%
4 JUL 2020: Images showing low confidence and high confidence for "Bangs" feature
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DONE: The gallery available in /home/arun.subramanian/ArunFolderBIOSID/faceAttention/faceAttributeClassification/face-attribute-prediction/confidencePlot/images/confidence on biosid server
High confidence images:
|bconf1| |bconf2| |bconf3| |bconf4|
Low confidence images
|bconf5| |bconf6|
.. |bconf1| image:: ./myImages/proj/bangs_confidence/high_out_0.png
:width: 45%
.. |bconf2| image:: ./myImages/proj/bangs_confidence/high_out_1.png
:width: 45%
.. |bconf3| image:: ./myImages/proj/bangs_confidence/high_out_2.png
:width: 45%
.. |bconf4| image:: ./myImages/proj/bangs_confidence/high_out_3.png
:width: 45%
.. |bconf5| image:: ./myImages/proj/bangs_confidence/low_out_0.png
:width: 45%
.. |bconf6| image:: ./myImages/proj/bangs_confidence/low_out_1.png
:width: 45%
Actions:
- Display images for qualitative
- check the ROC curve range
- Plot threshold of confidence curve with high granularity on the same graph.
- Get all images, and create a gallery of the "doubtfuls"
DONE: The gallery available in /home/arun.subramanian/ArunFolderBIOSID/faceAttention/faceAttributeClassification/face-attribute-prediction/confidencePlot/images/doubtfuls on biosid server
- Get a head post estimator and plot the graph of pose variation for images in probe and gallery in P1,P2,P3
11-JUL-2020
~~~~~~~~~~~
Had tried deep network pose model by implementing : https://github.com/natanielruiz/deep-head-pose
The following code used landmark detection https://github.com/qhan1028/Headpose-Detection which I used below
Sample labelled pose images
Straight looking:
|jul11simg1| |jul11simg2| |jul11simg3| |jul11simg4|
.. |jul11simg1| image:: ./myImages/proj/Template_img_straight1.jpg
:width: 45%
.. |jul11simg2| image:: ./myImages/proj/Template_img_straight2.jpg
:width: 45%
.. |jul11simg3| image:: ./myImages/proj/Template_img_straight3.jpg
:width: 45%
.. |jul11simg4| image:: ./myImages/proj/Template_img_straight4.jpg
:width: 45%
.. |jul11simg5| image:: ./myImages/proj/Template_img_angled1.jpg
:width: 45%
.. |jul11simg6| image:: ./myImages/proj/Template_img_angled2.jpg
:width: 45%
.. |jul11simg7| image:: ./myImages/proj/Template_img_angled3.jpg
:width: 45%
.. |jul11simg8| image:: ./myImages/proj/Template_img_angled4.jpg
:width: 45%
Angled looking:
|jul11simg5| |jul11simg6| |jul11simg7| |jul11simg8|
Angle histogram plots for the above type of images with two sets:
1) All straight looking faces
2) All angled faces
3) Plotting both of the above on same graph
|jul11plot1| |jul11plot2| |jul11plot3|
.. |jul11plot1| image:: ./myImages/proj/Template_straight_label.jpg
:width: 45%
.. |jul11plot2| image:: ./myImages/proj/Template_angled_label.jpg
:width: 45%
.. |jul11plot3| image:: ./myImages/proj/Template_combined_labels.jpg
:width: 45%
Plotting the same for gallery-having-attributes versus probe-NOT-having-attributes for each attribute:
|jul11p_y_r_1| |jul11p_y_r_2|
Bangs------------------------------------------------------------------------Similing
|jul11p_y_r_3| |jul11p_y_r_4|
Eyeglasses------------------------------------------------------------------------Goatee
|jul11p_y_r_5| |jul11p_y_r_6|
Sideburns------------------------------------------------------------------------Mustache
.. |jul11p_y_r_1| image:: ./myImages/proj/bang_pitch_yaw_roll.jpg
:width: 45%
.. |jul11p_y_r_2| image:: ./myImages/proj/smiling_pitch_yaw_roll.jpg
:width: 45%
.. |jul11p_y_r_3| image:: ./myImages/proj/eyeglasses_pitch_yaw_roll.jpg
:width: 45%
.. |jul11p_y_r_4| image:: ./myImages/proj/goatee_pitch_yaw_roll.jpg
:width: 45%
.. |jul11p_y_r_5| image:: ./myImages/proj/sideburns_pitch_yaw_roll.jpg
:width: 45%
.. |jul11p_y_r_6| image:: ./myImages/proj/mustache_pitch_yaw_roll.jpg
:width: 45%