-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathhoi-det.html
1739 lines (1573 loc) · 73.4 KB
/
hoi-det.html
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
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<html>
<head>
<title>Locate the human being and the object involved in certain activity in the picture</title>
<!-- simpleamt depends on these libraries -->
<script src='//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js'></script>
<script src='//cdnjs.cloudflare.com/ajax/libs/json3/3.3.2/json3.min.js'></script>
<!-- end of required libraries -->
<script src='//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js'></script>
<script src='//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.6.0/underscore-min.js'></script>
<link href='//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css' rel='stylesheet'>
<style>
#text-area {
margin: 5px;
font-size: 9pt;
height: 80px;
}
#button-div {
margin-bottom: 5px;
}
#counter {
margin: 10px;
font-size: 20pt;
font-weight: bold;
}
img {
height: 350px;
}
#wrap {
width:1200px;
margin:0 auto;
}
#left_col {
margin: 0 0 0 20px;
float:left;
width:810px;
}
#right_col {
margin: 0 20px 0 0;
float:right;
width:330px;
}
</style>
</head>
<body>
<!--
button colors:
btn-default white
btn-primary blue
btn-success green
btn-info cyan
btn-warning yellow
btn-danger red
btn-link white (hyperlink)
btn-group gray
-->
<!-- Instructions -->
<div class='container' style='width: 1200px;'>
<div class='panel panel-primary'>
<div class='panel-heading'><font size='3'><strong>Instructions — IMPORTANT: Read Before You Start</strong></font></div>
<div class='panel-body'>
<p>
<font size='3'>
You will be given <strong>pictures</strong> and their <strong>descriptions</strong>.
Each <strong>description</strong> will tell you a specific <strong><u>interaction</u></strong> between <strong><u>people</u></strong> and <strong><u>objects</u></strong> in the picture, for example, <strong><u>a person riding a bicycle</u></strong>.
Your task is to <strong>draw tight boxes around each person and each object involved in the given interaction</strong>, and <strong>link a person to an object if you see the interaction happening between them</strong>.
</font>
</p>
<!-- sample annotations -->
<div style="margin-top: 10pt; margin-bottom: 20pt;">
<center>
<h5>Sample annotations for the description "<strong><u>A person riding a bicycle.</u></strong>"</h5>
<img src='https://umich-ywchao-hico.github.io/hoi-det-ui/figures/anno_HICO_train2015_00000019.png' alt='tutorial1' style='height:200px;'>
<img src='https://umich-ywchao-hico.github.io/hoi-det-ui/figures/anno_HICO_train2015_00000667.png' alt='tutorial2' style='height:200px;'>
<img src='https://umich-ywchao-hico.github.io/hoi-det-ui/figures/anno_HICO_train2015_00001538.png' alt='tutorial3' style='height:200px;'>
</center>
</div>
<!--
<p>
<font size='3'>
For <strong>each picture</strong>, you have to <strong>first answer two starter questions</strong>, for example,
<br>
<span style="text-align: left; font-size: 14px; margin: 10px 0 10px 30px; display:block;">
Do you see more than five people? <br>
Do you see more than five bicycle? <br>
</span>
If you answer <strong>no on both</strong>, you should <strong>start annotating the picture</strong>. If you answer <strong>yes on at least one</strong>, you should <strong>skip the picture by clicking Next</strong>.
</font>
</p>
-->
<p style="margin-bottom: 16pt;"></p>
<p>
<font size='3'>
Once you start the annotation, your task for involves <strong>three steps</strong>:
</font>
</p>
<!-- Step 1 -->
<div style="margin-left: 16px;">
<p>
<font size='3'>
<strong>Step 1:</strong> <strong>Draw a tight box around each <u>person</u> involved in the interaction</strong>
<a id="pointer-phs1" style="cursor:pointer;">Click to expand</a>
<br>
For example, draw a tight box around each person riding bicycles; ignore all the people not riding bicycles.
</font>
</p>
<div class="collapse" id="expand-phs1" style="margin-bottom: 20pt;">
<ul>
<img src='https://umich-ywchao-hico.github.io/hoi-det-ui/figures/step1_1.gif' alt='tutorial1' style="height: 75px; float: left; margin-right: 30px">
<div style="display: table;">
<div style="display: table-cell; vertical-align: middle;">
<li>
<strong>Draw a box</strong>
<ol>
<li>Hold down your left mouse button.</li>
<li>Move the cursor around.</li>
<li>Release your left mouse button.</li>
</ol>
</li>
</div>
</div>
<img src='https://umich-ywchao-hico.github.io/hoi-det-ui/figures/step1_2.gif' alt='tutorial1' style="height: 75px; float: left; margin-right: 30px; margin-top: 20px">
<div style="display: table; margin-top: 5px">
<div style="display: table-cell; vertical-align: middle;">
<li>
<strong>Adjust a box</strong>
<ol>
<li>Move the cursor to one vertex of the box you want to adjust. You will see the vertex becomes bigger.</li>
<li>Hold down your left mouse button</li>
<li>Move the cursor around.</li>
<li>Releasing your left mouse button.</li>
</ol>
</li>
</div>
</div>
<img src='https://umich-ywchao-hico.github.io/hoi-det-ui/figures/step1_3.gif' alt='tutorial1' style="height: 75px; float: left; margin-right: 30px; margin-top: 10px">
<div style="display: table; margin-top: 15px">
<div style="display: table-cell; vertical-align: middle;">
<li>
<strong>Delete a box</strong>
<ol>
<li>Click on the box once. This will highlight the box.</li>
<li>Click on the box again. This will delete the box.</li>
</ol>
</li>
</div>
</div>
</ul>
</div>
</div>
<!-- Step 2 -->
<div style="margin-left: 16px;">
<p>
<font size='3'>
<strong>Step 2:</strong> <strong>Draw a tight box around each <u>object</u> involved in the interaction</strong>
<a id="pointer-phs2" style="cursor:pointer;">Click to expand</a>
<br>
For example, draw a tight box around each bicycle being ridden by people; ignore all the bicycles not being ridden.
</font>
</p>
<div class="collapse" id="expand-phs2" style="margin-bottom: 20pt;">
<ul>
<img src='https://umich-ywchao-hico.github.io/hoi-det-ui/figures/step2_1.gif' alt='tutorial1' style="height: 75px; float: left; margin-right: 30px">
<div style="display: table;">
<div style="display: table-cell; vertical-align: middle;">
<li>
<strong>Draw a box</strong>
<ol>
<li>Hold down your left mouse button.</li>
<li>Move the cursor around.</li>
<li>Release your left mouse button.</li>
</ol>
</li>
</div>
</div>
<img src='https://umich-ywchao-hico.github.io/hoi-det-ui/figures/step2_2.gif' alt='tutorial1' style="height: 75px; float: left; margin-right: 30px; margin-top: 20px">
<div style="display: table; margin-top: 5px">
<div style="display: table-cell; vertical-align: middle;">
<li>
<strong>Adjust a box</strong>
<ol>
<li>Move the cursor to one vertex of the box you want to adjust. You will see the vertex becomes bigger.</li>
<li>Hold down your left mouse button</li>
<li>Move the cursor around.</li>
<li>Releasing your left mouse button.</li>
</ol>
</li>
</div>
</div>
<img src='https://umich-ywchao-hico.github.io/hoi-det-ui/figures/step2_3.gif' alt='tutorial1' style="height: 75px; float: left; margin-right: 30px; margin-top: 10px">
<div style="display: table; margin-top: 15px">
<div style="display: table-cell; vertical-align: middle;">
<li>
<strong>Delete a box</strong>
<ol>
<li>Click on the box once. This will highlight the box.</li>
<li>Click on the box again. This will delete the box.</li>
</ol>
</li>
</div>
</div>
</ul>
</div>
</div>
<!-- Step 3 -->
<div style="margin-left: 16px;">
<p>
<font size='3'>
<strong>Step 3:</strong> <strong>Link a person to an object if the <u>interaction</u> is happening between them</strong>.
<a id="pointer-phs3" style="cursor:pointer;">Click to expand</a>
<br>
For example, link a person to a bicycle if that person is riding that bicycle.
</font>
</p>
<div class="collapse" id="expand-phs3" style="margin-bottom: 20pt;">
<ol>
<img src='https://umich-ywchao-hico.github.io/hoi-det-ui/figures/step3_1.gif' alt='tutorial1' style="height: 75px; float: left; margin-right: 30px; margin-top: 5px">
<div style="display: table; margin-top: 5px">
<div style="display: table-cell; vertical-align: middle;">
<li>
<strong>Select one person and draw links to all the objects which he/she is interacting with.</strong>
<ol t ype="a">
<li>Click on one person box. This will highlight the person.</li>
<li>Click on one object box. This will draw a link from the person to the object.</li>
</ol>
</li>
<li>
<strong>Remove a link by clicking on the object box again.</strong>
</li>
<li>
<strong>Switch to another person by clicking on another person box.</strong>
</li>
<li>
<strong>Repeat until all the person boxes are done.</strong>
</li>
</div>
</div>
</ol>
</div>
</div>
<p>
<font size='3'>
If the person or object involved in the interaction is <strong>not visible in the picture</strong>, you should <strong>check the square box under Reset</strong> and <strong>skip the picture</strong>.
</font>
</p>
<p style="margin-bottom: 16pt;"></p>
<!-- Notes -->
<p><font size='3'><strong>Notes</strong></font></p>
<ol>
<li>You are free to swtich between steps. You can always go back to previous steps if you need to make changes.</li>
<li>If a person or object is <strong>occluded</strong> or <strong>cut by the picture</strong>, draw a box only around its <strong>visible</strong> part.</li>
<li><strong>Do not draw box</strong> around <strong>people</strong> or <strong>object</strong> that is <strong>not involved in the interaction</strong>.</li>
<li>Make sure you link <strong>every person-object pair</strong> where you see the given interaction.</li>
</ol>
<!-- More Examples -->
<p>
<font size='3'>
<a id="pointer-ex" style="cursor: pointer; font-weight: bold;">Click to see more examples</a>
</font>
</p>
<div class="collapse" id="expand-ex" style="margin-bottom: 20pt;">
<center>
<table>
<tr>
<td colspan="4" style="text-align: center; padding: 0px 0px 5px 0px;">
If a person or object is <strong>occluded</strong> or <strong>cut by the picture</strong>, draw a box only around its <strong>visible</strong> part.
</td>
</tr>
<tr>
<td style="padding: 0px 2px 0px 2px; text-align: center;">
<figure>
<figcaption style="text-align: center;"><h5><strong><u>A person riding an airplane.</u></strong></h5></figcaption>
<img src='https://umich-ywchao-hico.github.io/hoi-det-ui/figures/anno_HICO_train2015_00003297.png' alt='tutorial1' style="height:180px; margin-bottom: 30px">
</figure>
</td>
<td style="padding: 0px 2px 0px 2px; text-align: center;">
<figure>
<figcaption style="text-align: center;"><h5><strong><u>A person feeding a bird.</u></strong></h5></figcaption>
<img src='https://umich-ywchao-hico.github.io/hoi-det-ui/figures/anno_HICO_train2015_00004795.png' alt='tutorial1' style="height:180px; margin-bottom: 30px">
</figure>
</td>
<td style="padding: 0px 2px 0px 2px; text-align: center;">
<figure>
<figcaption style="text-align: center;"><h5><strong><u>A person petting a bird.</u></strong></h5></figcaption>
<img src='https://umich-ywchao-hico.github.io/hoi-det-ui/figures/anno_HICO_train2015_00005403.png' alt='tutorial1' style="height:180px; margin-bottom: 30px">
</figure>
</td>
<td style="padding: 0px 2px 0px 2px; text-align: center; width: 220px">
<figure>
<figcaption style="text-align: center;"><h5><strong><u>A person exiting an airplane.</u></strong></h5></figcaption>
<img src='https://umich-ywchao-hico.github.io/hoi-det-ui/figures/anno_HICO_train2015_00024354.png' alt='tutorial1' style="height:180px; margin-bottom: 30px">
</figure>
</td>
</tr>
<tr>
<td colspan="4" style="text-align: center; padding: 0px 0px 5px 0px;">
<strong>Do not draw box</strong> around <strong>people</strong> or <strong>object</strong> that is <strong>not involved in the interaction</strong>.
</td>
</tr>
<tr>
<td style="padding: 0px 2px 0px 2px; text-align: center;">
<figure>
<figcaption style="text-align: center;"><h5><strong><u>A person washing a bicycle</u></strong></h5></figcaption>
<img src='https://umich-ywchao-hico.github.io/hoi-det-ui/figures/anno_HICO_test2015_00004178.png' alt='tutorial1' style="height:180px; margin-bottom: 30px">
</figure>
</td>
<td style="padding: 0px 2px 0px 2px; text-align: center;">
<figure>
<figcaption style="text-align: center;"><h5><strong><u>A person tying a boat.</u></strong></h5></figcaption>
<img src='https://umich-ywchao-hico.github.io/hoi-det-ui/figures/anno_HICO_train2015_00036117.png' alt='tutorial1' style="height:180px; margin-bottom: 30px">
</figure>
</td>
<td style="padding: 0px 2px 0px 2px; text-align: center;">
<figure>
<figcaption style="text-align: center;"><h5><strong><u>A person repairing an umbrella.</u></strong></h5></figcaption>
<img src='https://umich-ywchao-hico.github.io/hoi-det-ui/figures/anno_HICO_train2015_00024148.png' alt='tutorial1' style="height:180px; margin-bottom: 30px">
</figure>
</td>
<td style="padding: 0px 2px 0px 2px; text-align: center; width: 200px">
<figure>
<figcaption style="text-align: center;"><h5><strong><u>A person hosing a car.</u></strong></h5></figcaption>
<img src='https://umich-ywchao-hico.github.io/hoi-det-ui/figures/anno_HICO_test2015_00006714.png' alt='tutorial1' style="height:180px; margin-bottom: 30px">
</figure>
</td>
</tr>
<tr>
<td colspan="4" style="text-align: center; padding: 0px 0px 5px 0px;">
Link <strong>every person-object pair</strong> where you see the given interaction.
</td>
</tr>
<tr>
<td style="padding: 0px 2px 0px 2px; text-align: center;">
<figure>
<figcaption style="text-align: center;"><h5><strong><u>A person boarding an airplane.</u></strong></h5></figcaption>
<img src='https://umich-ywchao-hico.github.io/hoi-det-ui/figures/anno_HICO_train2015_00009719.png' alt='tutorial1' style="height:180px; margin-bottom: 10px">
</figure>
</td>
<td style="padding: 0px 2px 0px 2px; text-align: center;">
<figure>
<figcaption style="text-align: center;"><h5><strong><u>A person chasing a bird.</u></strong></h5></figcaption>
<img src='https://umich-ywchao-hico.github.io/hoi-det-ui/figures/anno_HICO_train2015_00016667.png' alt='tutorial1' style="height:180px; margin-bottom: 10px">
</figure>
</td>
<td style="padding: 0px 2px 0px 2px; text-align: center;">
<figure>
<figcaption style="text-align: center;"><h5><strong><u>A person herding a cow.</u></strong></h5></figcaption>
<img src='https://umich-ywchao-hico.github.io/hoi-det-ui/figures/anno_HICO_train2015_00006003.png' alt='tutorial1' style="height:180px; margin-bottom: 10px">
</figure>
</td>
<td style="padding: 0px 2px 0px 2px; text-align: center; width: 200px">
<figure>
<figcaption style="text-align: center;"><h5><strong><u>A person eating at a dining table.</u></strong></h5></figcaption>
<img src='https://umich-ywchao-hico.github.io/hoi-det-ui/figures/anno_HICO_train2015_00000902.png' alt='tutorial1' style="height:180px; margin-bottom: 10px">
</figure>
</td>
</tr>
</table>
</center>
</div>
<p style="margin-bottom: 12pt;"></p>
<!-- Keyboard Interface -->
<p><font size='3'><strong>Keyboard interface</strong></font></p>
<ol>
<li><strong>G</strong> / <strong>A</strong> : Go to the next/previous picture.</li>
<li><strong>S</strong>: Switch to Step 1.</li>
<li><strong>D</strong>: Switch to Step 2.</li>
<li><strong>F</strong>: Switch to Step 3.</li>
<li><strong>R</strong>: Reset annotations on the current picture.</li>
</ol>
<p style="margin-bottom: 12pt;"></p>
<!-- warning -->
<font size='3'><strong><u>Warning</u></strong>: Rejection is possible if your accuracy is too low.</font>
</div>
</div>
</div>
<!-- End Instructions -->
<div class='container' style="width: 1200px; margin-bottom: 10pt">
<div class='panel panel-primary'>
<div class='panel-heading' style="color:#fff; background-color:#5cb85c; border-color:#4cae4c;"><font size='3'><strong>HIT Starts Here</strong></font></div>
</div>
</div>
<div class='container' style="display: table; width: 1000px; height: 50px; margin-bottom: 10pt">
<div style="display: table-cell; vertical-align: middle;">
<center>
<font size='6'>Description: <strong><u><span id="description"></span></u></strong></font>
</center>
</div>
</div>
<br>
<div id="wrap">
<div id="left_col">
<fieldset>
<!-- <div style="display: table; width: 810px; height: 975px; border:1px solid black;" onselectstart="return false"> -->
<div style="display: table; width: 810px; height: 810px; border:1px solid black;" onselectstart="return false">
<div style="display: table-cell; vertical-align: middle;">
<!-- image -->
<center><canvas id='segmentation_canvas' width=600 height=400></canvas></center>
</div>
</div>
</fieldset>
</div>
<div id="right_col">
<fieldset>
<!-- <div style="display: table; width: 330px; height: 975px; border:1px solid black;"> -->
<div style="display: table; width: 330px; height: 810px; border:1px solid black;">
<div style="display: table-cell; vertical-align: middle;">
<!-- <div style="display: table-cell;"> -->
<div>
<p style="margin-bottom: 10pt;"></p>
</div>
<!-- text area -->
<!--
<div class='col-xs-12 text-center'>
<center>
<textarea id='text-area' class='form-control tb-margin' style="margin: 0pt; height: 240pt; margin-bottom: 30pt; resize: none;" disabled></textarea>
</center>
</div>
-->
<!-- <center> -->
<!-- <div style="width: 300px; padding: 8px 14px 16px 14px; margin-bottom: 30px; border: 2px solid; border-radius: 5px;"> -->
<!-- <div style="text-align: left; font-size: 14px;"> -->
<!-- <div style="font-size: 16px; margin-bottom: 5px;"><strong>Note:</strong></div> -->
<!-- <div>
If you have done this task recently, you might notice this one is different:
In the past ones you first answer questions about the number of people/objects, which might tell you to skip the picture.
<u>The task here is same as the past ones</u>, but <u>you need to work on all the picture regardless of the number of people/objects</u>.
</div> -->
<!-- question title -->
<!--<div style="font-size: 16px; margin-bottom: 5px;"><strong>Answer the questions first:</strong></div>-->
<!-- question 1 -->
<!--
<div style="font-size: 13px;">Do you see more than five people?</div>
<form id="form-1" style="text-align:center; margin-bottom: 0px">
<input type="radio" name="ans-1" id="ans-1-y" value="y" style="width: 20px; height: 20px" disabled>
<label for="ans-1-y" style="font-size: 18px;">Yes</label>
<input type="radio" name="ans-1" id="ans-1-n" value="n" style="width: 20px; height: 20px" disabled>
<label for="ans-1-n" style="font-size: 18px;">No</label>
</form>
-->
<!-- question 2 -->
<!--
<div style="font-size: 13px;">Do you see more than five <span class="obj-name"></span>?</div>
<form id="form-2" style="text-align:center; margin-bottom: 5px;">
<input type="radio" name="ans-2" id="ans-2-y" value="y" style="width: 20px; height: 20px" disabled>
<label for="ans-2-y" style="font-size: 18px;">Yes</label>
<input type="radio" name="ans-2" id="ans-2-n" value="n" style="width: 20px; height: 20px" disabled>
<label for="ans-2-n" style="font-size: 18px;">No</label>
</form>
-->
<!-- guiding sentence -->
<!--<div>-->
<!-- Click the button to skip this picture. -->
<!-- Please start the annotation. -->
<!-- <span id="guide-radio"></span>-->
<!-- <button id="skip" class="btn btn-lg btn-primary" style="padding: 5; font-size: 14px; float: right; margin-top: -6px" disabled>Skip</strong> -->
<!--</div>-->
<!-- </div> -->
<!-- </div> -->
<!-- </center> -->
<!-- phase switch -->
<div class='col-xs-12 text-center'>
<center>
<div style="display: table; width: 297px; height: 75px; margin-bottom: 10pt;">
<div style="display: table-cell; vertical-align: middle;">
<button id='phs1-btn' class='btn btn-lg btn-primary' style="width: 180pt;" disabled>Draw box <br>around person</button> <tt><strong>[S]</strong></tt>
</div>
</div>
<div style="display: table; width: 297px; height: 75px; margin-bottom: 10pt;">
<div style="display: table-cell; vertical-align: middle;">
<button id='phs2-btn' class='btn btn-lg btn-success' style="width: 180pt;" disabled>Draw box <br>around <span class="obj-name"></span></button> <tt><strong>[D]</strong></tt>
</div>
</div>
<div style="display: table; width: 297px; height: 75px; margin-bottom: 20pt;">
<div style="display: table-cell; vertical-align: middle;">
<button id='phs3-btn' class='btn btn-lg btn-warning' style="width: 180pt;" disabled>Link person <br>to <span class="obj-name"></span></button> <tt><strong>[F]</strong></tt>
</div>
</div>
</center>
</div>
<!-- Reset -->
<div class='col-xs-12 text-center'>
<center>
<button id='reset-btn' class='btn btn-lg btn-danger' style="width: 180pt;" disabled>Reset on this picture</button> <tt><strong>[R]</strong></tt>
<p style="margin-bottom: 20pt;"></p>
</center>
</div>
<!-- non-visibility check -->
<div class='col-xs-12 text-center'>
<center>
<form>
<input type="checkbox" id="not_vis" style="width: 36px; height: 36px; vertical-align: middle; position: relative; bottom: 15px; background-color: #9FFF9D; visibility: visible;" disabled>
<div id="checkbox-label" style="width: 250px; display: inline-block; margin-left: 5px; text-align: left; font-size: 14px; vertical-align: middle;">
Check this box if it is impossible to draw a box on person or <span class="obj-name"></span>. For example, if all people or all <span class="obj-name"></span> involved in the interaction is <strong>fully occluded or outside the picture</strong>.
<p style="margin-bottom: 5pt;"></p>
<!-- guiding sentence -->
<span id="guide-check"></span>
</div>
</form>
<p style="margin-bottom: 10pt"></p>
</center>
</div>
<!-- back / next -->
<div class='col-xs-12 text-center' id='button-div'>
<button id='prev-btn' class='btn btn-lg btn-primary' style="width: 79pt; margin-bottom: 3pt" disabled>Back</button>
<button id='next-btn' class='btn btn-lg btn-primary' style="width: 79pt; margin-bottom: 3pt" disabled>Next</button>
<br>
<tt><strong>[A]</strong></tt>
<tt><strong>[G]</strong></tt>
<p style="margin-bottom: 7pt;"></p>
<p>
<span id='counter'>
<span class='counter-top'></span> / <span class='counter-bottom'></span>
</span>
</p>
</div>
<!-- submit -->
<div class='col-xs-12 text-center'>
{% include "simpleamt.html" %}
<!-- <link rel="import" href="simpleamt.html"> -->
</div>
</div>
</div>
</fieldset>
</div>
</div>
<!-- functions for instruction -->
<script>
$(function() {
$("#pointer-phs1").click(function(){ $("#expand-phs1").collapse('toggle'); });
$("#pointer-phs2").click(function(){ $("#expand-phs2").collapse('toggle'); });
$("#pointer-phs3").click(function(){ $("#expand-phs3").collapse('toggle'); });
$("#pointer-ex").click(function(){ $("#expand-ex").collapse('toggle'); });
$("#expand-phs1").on('shown.bs.collapse', function(){ $("#pointer-phs1").text('Click to Collapse'); });
$("#expand-phs2").on('shown.bs.collapse', function(){ $("#pointer-phs2").text('Click to Collapse'); });
$("#expand-phs3").on('shown.bs.collapse', function(){ $("#pointer-phs3").text('Click to collapse'); });
$("#expand-ex").on('shown.bs.collapse', function(){ $("#pointer-ex").text('Click to collapse'); });
$("#expand-phs1").on('hidden.bs.collapse', function(){ $("#pointer-phs1").text('Click to Expand'); });
$("#expand-phs2").on('hidden.bs.collapse', function(){ $("#pointer-phs2").text('Click to Expand'); });
$("#expand-phs3").on('hidden.bs.collapse', function(){ $("#pointer-phs3").text('Click to Expand'); });
$("#expand-ex").on('hidden.bs.collapse', function(){ $("#pointer-ex").text('Click to see more examples'); });
});
</script>
<script>
$(function() {
// Define some default input.
var DEFAULT_INPUT = [
['https://umich-ywchao-hico.github.io/hoi-det-ui/HICO_train2015_00000019.jpg', 'A person riding a bicycle.', 'bicycle'],
['https://umich-ywchao-hico.github.io/hoi-det-ui/HICO_train2015_00000202.jpg', 'A person riding a bicycle.', 'bicycle'],
['https://umich-ywchao-hico.github.io/hoi-det-ui/HICO_train2015_00000667.jpg', 'A person riding a bicycle.', 'bicycle'],
['https://umich-ywchao-hico.github.io/hoi-det-ui/HICO_train2015_00001538.jpg', 'A person riding a bicycle.', 'bicycle'],
['https://umich-ywchao-hico.github.io/hoi-det-ui/HICO_train2015_00004795.jpg', 'A person feeding a bird.', 'bird'],
['https://umich-ywchao-hico.github.io/hoi-det-ui/HICO_train2015_00001741.jpg', 'A person riding a bicycle.', 'bicycle'],
['https://umich-ywchao-hico.github.io/hoi-det-ui/HICO_train2015_00001762.jpg', 'A person riding a bicycle.', 'bicycle'],
['https://umich-ywchao-hico.github.io/hoi-det-ui/HICO_train2015_00002338.jpg', 'A person riding a bicycle.', 'bicycle']
];
var input = null;
// is the image qualified for annotation
var ans_1 = [];
var ans_2 = [];
// is the person and object visible in the image
var not_vis = [];
// some variables to track state of the HIT.
var idx = 0;
var enabled = false;
// global variables for the page
var img;
var canvas_fix;
var ctx;
// cursor state
var cursor_x = 0;
var cursor_y = 0;
var mouse_down = false;
// task phase
var phase = [];
// returning rectangle stacks
// Rectangles in each stack are sorted by area in ascending order
var return_rect_stack_1 = []; // person
var return_rect_stack_2 = []; // object
var concat_rect_stack = [];
var concat_rect_stack_ind = [];
// returning connection stacks
// Indice are sorted in ascending order
var return_conn_stack = [];
// temporary variable for drawing rectangles
var raw_rect_x = new Array(4);
var raw_rect_y = new Array(4);
// drawing styles
var ln_clr_1 = 'blue';
var ln_clr_2 = 'lime';
var vt_clr = 'red';
var ln_width_fg = 4.0;
var ln_width_bg = 2.0;
var vt_width = 4.0;
var vt_width_bold = 8.0;
// bounding box adjustment
var adj_on = false;
var adj_rt_idx = -1
var adj_cand_rt = null;
var adj_cand_rt_idx = -1; // required for draw_canvas()
var adj_cand_ln_clr = null;
var adj_cand_vt_idx = -1;
var adj_cand_vt_thres = 8;
// bounding box highlight
var hl_rt = null;
var hl_rt_idx = -1;
var hl_cand_rt = null;
var hl_cand_rt_idx = -1;
var hl_cand_ln_clr = null;
var hl_cand_opa = 0.3;
var hl_down_opa = 0.5;
var hl_draw = true;
// connection annotation
var conn_ln_clr = 'red';
var conn_ln_width_cand = 1.0;
var conn_ln_width_on = 4.0;
var conn_ln_opa_cand = 1;
var conn_ln_opa_on = 1;
var conn_cr_clr = 'red';
var conn_cr_rad = 4;
// Initalizing the canvas.
function init_canvas() {
// get canvas
img = new Image();
canvas_fix = document.getElementById('segmentation_canvas');
ctx = canvas_fix.getContext('2d');
// change the size of the canvas to the image size
img.onload = function() {
canvas_fix.width = this.width;
canvas_fix.height = this.height;
draw_canvas();
}
img.src = input[idx][0];
// monitor user input
if (ans_1[idx] == 'n' && ans_2[idx] == 'n') {
canvas_fix.onmousemove = mousemove_canvas_rect;
canvas_fix.onmousedown = mousedown_canvas_rect;
canvas_fix.onmouseup = mouseup_canvas_rect;
}
else {
reset_annotation();
canvas_fix.onmousemove = function(){ return false; }
canvas_fix.onmousedown = function(){ return false; }
canvas_fix.onmouseup = function(){ return false; }
}
// render
render();
}
// Draw canvas.
function draw_canvas() {
// Draw the image
ctx.clearRect(0, 0, canvas_fix.width, canvas_fix.height);
draw_image();
// Draw boxes in stack 1
$.each(return_rect_stack_1[idx], function(index, clean_rect) {
// Skip the one that is currently being adjusted
if (phase[idx] == 1 && adj_on && index == adj_rt_idx) { return true; }
if (phase[idx] == 1) { draw_rect(clean_rect[0], clean_rect[1], ln_clr_1, ln_width_fg, true); }
if (phase[idx] == 2) { draw_rect(clean_rect[0], clean_rect[1], ln_clr_1, ln_width_bg, false); }
if (phase[idx] == 3) { draw_rect(clean_rect[0], clean_rect[1], ln_clr_1, ln_width_bg, false); }
})
// Draw boxes in stack 2
$.each(return_rect_stack_2[idx], function(index, clean_rect) {
// Skip the one that is currently being adjusted
if (phase[idx] == 2 && adj_on && index == adj_rt_idx) { return true; }
if (phase[idx] == 1) { draw_rect(clean_rect[0], clean_rect[1], ln_clr_2, ln_width_bg, false); }
if (phase[idx] == 2) { draw_rect(clean_rect[0], clean_rect[1], ln_clr_2, ln_width_fg, true); }
if (phase[idx] == 3) { draw_rect(clean_rect[0], clean_rect[1], ln_clr_2, ln_width_bg, false); }
})
// Draw connected box
if (phase[idx] == 3) {
for (var i = 0; i < return_rect_stack_1[idx].length; i++) {
if (hl_rt && i == concat_rect_stack_ind[idx][hl_rt_idx][1]) { draw_conn_hl(i, ln_width_fg); }
}
}
// Draw highlight box
if (hl_draw && hl_rt) {
if (phase[idx] == 1) { fill_rect(hl_rt[0], hl_rt[1], ln_clr_1, hl_down_opa, ln_width_fg, true); }
if (phase[idx] == 2) { fill_rect(hl_rt[0], hl_rt[1], ln_clr_2, hl_down_opa, ln_width_fg, true); }
if (phase[idx] == 3) { fill_rect(hl_rt[0], hl_rt[1], ln_clr_1, hl_down_opa, ln_width_bg, false); }
}
// Draw connected line and circle
if (phase[idx] == 3) {
for (var i = 0; i < return_rect_stack_1[idx].length; i++) {
if (hl_rt && i == concat_rect_stack_ind[idx][hl_rt_idx][1]) {
draw_conn_ln(i, conn_ln_width_on, conn_ln_opa_on);
}
else {
draw_conn_ln(i, conn_ln_width_cand, conn_ln_opa_cand);
}
}
}
}
// Draw image.
function draw_image() {
ctx.drawImage(img, 0, 0, canvas_fix.width, canvas_fix.height);
}
// Do something as the cursor moves across the canvas
function mousemove_canvas_rect(event) {
draw_canvas();
// Get current cursor coordinates
grab_xy(event);
// Phase 1 and Phase 2 only
if (phase[idx] == 1 || phase[idx] == 2) {
// Draw bounding box
if (mouse_down) {
raw_rect_x[2] = cursor_x;
raw_rect_y[2] = cursor_y;
clean_rect = clean_up_raw_rect();
if (phase[idx] == 1) { draw_rect(clean_rect[0], clean_rect[1], ln_clr_1, ln_width_fg, true); }
if (phase[idx] == 2) { draw_rect(clean_rect[0], clean_rect[1], ln_clr_2, ln_width_fg, true); }
}
// Adjust bounding box
if (!mouse_down) {
get_closest_vertex_idx();
if (adj_cand_rt) {
bold_point(adj_cand_rt[0][adj_cand_vt_idx], adj_cand_rt[1][adj_cand_vt_idx]);
}
}
}
// Highlight bounding box
if (!mouse_down) {
get_highlight_rect();
if (hl_cand_rt && !adj_cand_rt) {
if (hl_rt_idx == hl_cand_rt_idx) {
// Do not add further effects if the box is currently highlighted
}
else {
// Draw highlight
if (phase[idx] == 1) { fill_rect(hl_cand_rt[0], hl_cand_rt[1], hl_cand_ln_clr, hl_cand_opa, ln_width_fg, true); }
if (phase[idx] == 2) { fill_rect(hl_cand_rt[0], hl_cand_rt[1], hl_cand_ln_clr, hl_cand_opa, ln_width_fg, true); }
if (phase[idx] == 3) {
fill_rect(hl_cand_rt[0], hl_cand_rt[1], hl_cand_ln_clr, hl_cand_opa, ln_width_bg, false);
// Re-draw connected line and circle on top
// This might cause unwanted effects if the opacity if not 1
if (hl_rt && concat_rect_stack_ind[idx][hl_cand_rt_idx][0] == 2) {
rt_idx_1 = concat_rect_stack_ind[idx][hl_rt_idx][1];
rt_idx_2 = concat_rect_stack_ind[idx][hl_cand_rt_idx][1];
if (return_conn_stack[idx][rt_idx_1].indexOf(rt_idx_2) != -1) {
draw_conn_ln(rt_idx_1, conn_ln_width_on, conn_ln_opa_on);
}
}
}
}
}
}
else {
// Make sure highlight is always off when the cursor starts being dragged
hl_rt = null;
hl_rt_idx = -1;
}
}
// Do something when the left key of the mouse is hit
function mousedown_canvas_rect(event) {
// Set cursor state
if (!mouse_down) {
raw_rect_x[0] = cursor_x;
raw_rect_y[0] = cursor_y;
mouse_down = true;
}
// Phase 1 and Phase 2 only
if (phase[idx] == 1 || phase[idx] == 2) {
// Adjust bounding box
if (adj_cand_rt) {
raw_rect_x[0] = adj_cand_rt[0][(adj_cand_vt_idx + 2) % 4];
raw_rect_y[0] = adj_cand_rt[1][(adj_cand_vt_idx + 2) % 4];
mouse_down = true;
adj_on = true;
adj_rt_idx = adj_cand_rt_idx;
hl_rt = null;
hl_rt_idx = -1;
draw_canvas();
raw_rect_x[2] = cursor_x;
raw_rect_y[2] = cursor_y;
clean_rect = clean_up_raw_rect();
draw_rect(clean_rect[0], clean_rect[1], adj_cand_ln_clr, ln_width_fg, true);
}
}
// Highlight bounding box
if (!adj_cand_rt) {
if (!hl_cand_rt) {
hl_rt = null;
hl_rt_idx = -1;
draw_canvas();
}
else {
if (hl_cand_rt_idx != hl_rt_idx) {
if (hl_rt) {
// Phase 1 and Phase 2 only
if (phase[idx] == 1 || phase[idx] == 2) {
hl_draw = false;
draw_canvas();
hl_draw = true;
}
// Phase 3 only
if (phase[idx] == 3) {
if (concat_rect_stack_ind[idx][hl_cand_rt_idx][0] == 1) {
hl_draw = false;
draw_canvas();
hl_draw = true;
}
else {
// Create effect for adding connection
}
}
}
}
// Draw highlight
if (phase[idx] == 1) { fill_rect(hl_cand_rt[0], hl_cand_rt[1], hl_cand_ln_clr, hl_cand_opa, ln_width_fg, true); }
if (phase[idx] == 2) { fill_rect(hl_cand_rt[0], hl_cand_rt[1], hl_cand_ln_clr, hl_cand_opa, ln_width_fg, true); }
if (phase[idx] == 3) { fill_rect(hl_cand_rt[0], hl_cand_rt[1], hl_cand_ln_clr, hl_cand_opa, ln_width_bg, false); }
// Draw connection
if (phase[idx] == 3) {
if (concat_rect_stack_ind[idx][hl_cand_rt_idx][0] == 1) {
rt_idx_1 = concat_rect_stack_ind[idx][hl_cand_rt_idx][1];
draw_conn_hl(rt_idx_1, ln_width_bg);
}
}
}
}
}
// Do something when the left key of the mouse is lifted
function mouseup_canvas_rect(event) {
// Response only if the click is on the canvas
if (mouse_down) {
// Save cursor coordinates
raw_rect_x[2] = cursor_x;
raw_rect_y[2] = cursor_y;
// Phase 1 and Phase 2 only
if (phase[idx] == 1 || phase[idx] == 2) {
// Save bounding box to stack
if (raw_rect_x[2] != raw_rect_x[0] ||
raw_rect_y[2] != raw_rect_y[0]) {
save_rect_to_stack();
update_concat_stack();
}
}
// Highlight bounding box
if (raw_rect_x[2] == raw_rect_x[0] &&
raw_rect_y[2] == raw_rect_y[0]) {
if (hl_cand_rt) {
// Phase 1 and Phase 2 only
if (phase[idx] == 1 || phase[idx] == 2) {
if (hl_cand_rt_idx != hl_rt_idx) {
// Highlight box
hl_rt = hl_cand_rt;
hl_rt_idx = hl_cand_rt_idx;
}
else {
// Remove box
remove_rect_from_stack(hl_rt_idx);
update_concat_stack();
hl_rt = null;
hl_rt_idx = -1;
// Prevent unwanted effects when triple click on a box
hl_cand_rt = null;
hl_cand_rt_idx = -1;
}
}
// Phase 3 only: connection annotation
if (phase[idx] == 3) {
if (hl_cand_rt_idx != hl_rt_idx) {
// Change hl_rt
if (concat_rect_stack_ind[idx][hl_cand_rt_idx][0] == 1) {
// Highlight box
hl_rt = hl_cand_rt;
hl_rt_idx = hl_cand_rt_idx;
}
if (concat_rect_stack_ind[idx][hl_cand_rt_idx][0] == 2) {
if (!hl_rt) {
// Should not starts with an object
alert('connection annotation error');
}
else {
// Toggle connection
conn = [concat_rect_stack_ind[idx][hl_rt_idx][1],
concat_rect_stack_ind[idx][hl_cand_rt_idx][1]];
toggle_conn(conn);
}
}
}
else {
// Disable highlighted box
hl_rt = null;
hl_rt_idx = -1;
}
}
}
}
}
// Set cursor state
mouse_down = false;
adj_on = false;
adj_rt_idx = -1;
// Display
draw_canvas();
render();
}
// Return the current point of the cursor.
function grab_xy(event) {
var ev = event || window.event;
var IE = document.all?true:false;
if (IE) {
// Grab the x-y pos if browser is IE
cx = ev.clientX + document.body.scrollLeft;
cy = ev.clientY + document.body.scrollTop;
}
else {
// Grab the x-y pos if browser is NS
cx = ev.pageX;
cy = ev.pageY;
}
cx = cx - canvas_fix.offsetLeft;
cy = cy - canvas_fix.offsetTop;