-
Notifications
You must be signed in to change notification settings - Fork 0
/
questions1.xml
2198 lines (1726 loc) · 99 KB
/
questions1.xml
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
<HTMLQuestion xmlns="http://mechanicalturk.amazonaws.com/AWSMechanicalTurkDataSchemas/2011-11-11/HTMLQuestion.xsd">
<HTMLContent><![CDATA[
<!-- YOUR HTML BEGINS -->
<!DOCTYPE html>
<html>
<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'/>
<style>
/* classes to hide and show different survey elements so that the elements are presented in a logical order */
.canvasDiv{display: none;}
.hideddd{display: none;}
.hided{display: none;}
.hidedd{display: none;}
.bye{display: none;}
.bye2{display: none;}
.showed{display: block;}
.showedd{display: block;}
.showeddd{display: block;}
.hi{display: block;}
.hi2{display: block;}
.showd{display: block;}
</style>
<script type='text/javascript' src='https://s3.amazonaws.com/mturk-public/externalHIT_v1.js'></script>
<script>
var a = [];
document.addEventListener("DOMContentLoaded", function(event) {
/*array a holds the information for each question. Each question has an array containing the four possible answers to be shuffled, link to original image, link to visual explanation image, ai answer, ai confidence, and correct answer.*/
a = [["hippo","flamingo","Ibizan hound","Indian elephant", "https://image.ibb.co/dFeQwn/flamingo.jpg", "https://image.ibb.co/mCDM6x/flamingo_gcam_resnet152.jpg", "flamingo", "0.999989995", "flamingo"],["little blue heron","toucan","black swan","king penguin", "https://image.ibb.co/g9ocbn/blackswan.jpg", "https://image.ibb.co/kv4B6x/black_swan_gcam_resnet152.jpg", "black swan", "1.000", "black swan"],["great grey owl","ostrich","white stork","quail","https://image.ibb.co/iGCW2S/greatgreyowl.jpg", "https://image.ibb.co/kLgVzH/great_grey_owl_gcam_resnet152.jpg", "great grey owl", "1.000", "great grey owl"],["African gray parrot","hummingbird","dragonfly","crane","https://image.ibb.co/mQMfwn/hummingbird.jpg","https://image.ibb.co/m2Ng6x/hummingbird_gcam_resnet152.jpg","hummingbird","1.000","hummingbird"],["fountain","peacock","jay","umbrella","https://image.ibb.co/ijnjp7/peacock.jpg","https://image.ibb.co/hE7ERx/peacock_gcam_resnet152.jpg","peacock","1.000","peacock"],["bald eagle","vulture","hen","kite","https://image.ibb.co/hWz3hS/baldeagle.jpg","https://image.ibb.co/cQAjRx/kite_gcam_resnet152.jpg","kite","0.98639","bald eagle"],["king penguin","ruffed grouse","jay","pelican","https://image.ibb.co/bPnCbn/pelican.jpg","https://image.ibb.co/mgY4Rx/king_penguin_gcam_resnet152.jpg","king penguin","0.97724","pelican"],["tree frog","vulture","alligator lizard","standard poodle","https://image.ibb.co/nt7vwn/vulture.jpg","https://image.ibb.co/cBDhDc/standard_poodle_gcam_resnet152.jpg","standard poodle","0.990768175","vulture"],["toucan","albatross","oystercatcher","great white heron","https://image.ibb.co/jrQb2S/toucan.jpg","https://image.ibb.co/iyNO3c/American_egret_gcam_resnet152.jpg","great white heron","1.000","toucan"],["hen","goose","robin","stingray","https://image.ibb.co/fS1AU7/hen.jpg","https://image.ibb.co/hcSHUH/goose_gcam_resnet152.jpg","goose","0.994044998","hen"],["partridge","chickadee","prairie chicken","cock","https://image.ibb.co/iPtkwn/prairiechicken.jpg","https://image.ibb.co/hFHj9H/prairie_chicken_gcam_resnet152.jpg","prairie chicken","0.999979998","prairie chicken"],["indigo bird","sulphur-crested cockatoo","lorikeet","macaw","https://image.ibb.co/fFXH97/macaw.jpg","https://image.ibb.co/bwyP9H/macaw_gcam_resnet152.jpg","macaw","0.99999","macaw"],["hornbill","black stork","crane","black grouse","https://image.ibb.co/cMAn97/blackstork.jpg","https://image.ibb.co/fCcsUH/black_stork_gcam_resnet152.jpg","black stork","0.999498562","black stork"],["limpkin","peacock","African gray parrot","bittern","https://image.ibb.co/irjuNS/limpkin.jpg","https://image.ibb.co/jtOubx/limpkin_gcam_resnet152.jpg","limpkin","0.999989998","limpkin"],["red-backed sandpiper","redshank","ptarmigan","dowitcher","https://image.ibb.co/bJ4B2S/dowitcher.jpg","https://image.ibb.co/gCoSwx/dowitcher_gcam_resnet152.jpg","dowitcher","0.965790567","dowitcher"],["water ouzel","oystercatcher","snowbird","water hen","https://image.ibb.co/eG5C97/waterouzel.jpg","https://image.ibb.co/btmK9H/oystercatcher_gcam_resnet152.jpg","oystercatcher","0.987968195","water ouzel"],["ruffed grouse","coucal","bustard","brambling","https://image.ibb.co/j5P0wn/coucal.jpg","https://image.ibb.co/m4BVGx/brambling_gcam_resnet152.jpg","brambling","0.999875721","coucal"],["drake","red-breasted merganser","ruddy turnstone","redshank","https://image.ibb.co/na7Cbn/redbreastedmerganser.jpg","https://image.ibb.co/ffPBOc/redshank_gcam_resnet152.jpg","redshank","0.96901","red-breasted merganser"],["spoonbill","jacamar","house finch","bulbul","https://image.ibb.co/bwNs97/jacamar.jpg","https://image.ibb.co/m3VJ3c/bulbul_gcam_resnet152.jpg","bulbul","0.98183566","jacamar"],["bee eater","European gallinule","junco","magpie","https://image.ibb.co/dxgihS/junco.jpg","https://image.ibb.co/g8Jo3c/European_gallinule_gcam_resnet152.jpg","European gallinule","0.999197673","junco"]];
/* shuffle the questions in array a */
var j, x, i;
for (i = a.length - 1; i > 0; i--) {
j = Math.floor(Math.random() * (i + 1));
x = a[i];
a[i] = a[j];
a[j] = x;
}
/* shuffle the possible answers for each question and insert them into the document */
for(k=0; k < (2*a.length); k++) {
var x = 4*k+1;
var y = Math.floor(k/2.0);
poss = [0,1,2,3];
var p, r, s;
for (s = poss.length - 1; s > 0; s--) {
p = Math.floor(Math.random() * (s + 1));
r = poss[s];
poss[s] = poss[p];
poss[p] = r;
}
document.getElementById("op"+x.toString()).innerHTML = a[y][poss[0]];
document.getElementById("in"+x.toString()).value = a[y][poss[0]];
document.getElementById("op"+(x+1).toString()).innerHTML = a[y][poss[1]];
document.getElementById("in"+(x+1).toString()).value = a[y][poss[0]];
document.getElementById("op"+(x+2).toString()).innerHTML = a[y][poss[2]];
document.getElementById("in"+(x+2).toString()).value = a[y][poss[2]];
document.getElementById("op"+(x+3).toString()).innerHTML = a[y][poss[3]];
document.getElementById("in"+(x+3).toString()).value = a[y][poss[3]];
}
/* add images and information regarding ai decisions/confidences and correct answers to document */
for(m=0; m < a.length; m++) {
document.getElementById("r"+(m+1).toString()).innerHTML = "AI's Decision: "+a[m][6]+"; Confidence: "+a[m][7]+". Please make a final decision.";
if(m==a.length-1){
document.getElementById("f"+(m+1).toString()).innerHTML = "The correct answer was "+a[m][8]+". Please answer the next few questions regarding the experiment.";
}
else{
document.getElementById("f"+(m+1).toString()).innerHTML = "The correct answer was "+a[m][8]+". Press 'Continue' to move on to the next question.";
}
document.getElementById("i"+(2*m+1).toString()).src = a[m][4]; /* original image */
document.getElementById("i"+(2*m+2).toString()).src = a[m][5]; /* visual explanation image */
}
/* initialize canvases on which workers may draw their own visual explanations */
var canvas = document.getElementById("canvas1");
canvas.clickX = new Array(); /* array to remember x-coordinate of clicks on image */
canvas.clickY = new Array(); /* array to remember y-coordinate of clicks on image */
canvas.clickDrag = new Array(); /* array to remember if each click involves dragging */
canvas.clickSize = new Array(); /* array to remember click's marker size (small, normal, large, or huge) */
canvas.curSize = "normal"; /* variable to remember current size of marker */
var paint; /* Boolean variable to turn the ability to paint the canvas on or off as necessary */
/* function to update the canvas' arrays with click information when mousedown occurs */
canvas.addEventListener("mousedown",function(e){
paint = true;
var context = canvas.getContext("2d");
redraw(this.clickX, this.clickY, context,this.clickDrag,this.clickSize);
addClick(e.pageX - this.offsetLeft, e.pageY - this.offsetTop, false, this.clickX, this.clickY,this.clickDrag,this.clickSize,this.curSize);
});
/* function to update the canvas' arrays with click information when mousemove occurs */
canvas.addEventListener("mousemove",function(e){
if(paint){
var context = canvas.getContext("2d");
redraw(this.clickX, canvas.clickY, context,this.clickDrag,this.clickSize);
addClick(e.pageX - this.offsetLeft, e.pageY - this.offsetTop, true, this.clickX, this.clickY,this.clickDrag,this.clickSize,this.curSize);
}
});
/* function to stop the ability to paint the canvas when mouse is up */
canvas.addEventListener("mouseup",function(e){
paint = false;
});
/* function to stop the ability to paint the canvas upon mouseleave */
canvas.addEventListener("mouseleave",function(e){
paint = false;
});
var canvas2 = document.getElementById("canvas2");
var context2 = canvas2.getContext("2d");
var outlineImage2 = new Image();
outlineImage2.src = a[1][4];
context2.drawImage(outlineImage2, 0, 0, 224, 224);
canvas2.clickX = new Array();
canvas2.clickY = new Array();
canvas2.clickDrag = new Array();
canvas2.clickSize = new Array();
canvas2.curSize = "normal";
var paint2;
canvas2.addEventListener("mousedown",function(e){
paint2 = true;
addClick(e.pageX - this.offsetLeft, e.pageY - this.offsetTop, false, this.clickX, this.clickY,this.clickDrag,this.clickSize,this.curSize);
redraw(this.clickX, this.clickY, context2,this.clickDrag,this.clickSize);
});
canvas2.addEventListener("mousemove",function(e){
if(paint2){
addClick(e.pageX - this.offsetLeft, e.pageY - this.offsetTop, true, this.clickX, this.clickY,this.clickDrag,this.clickSize,this.curSize);
redraw(this.clickX, this.clickY, context2,this.clickDrag,this.clickSize);
}
});
canvas2.addEventListener("mouseup",function(e){
paint2 = false;
});
canvas2.addEventListener("mouseleave",function(e){
paint2 = false;
});
var canvas3 = document.getElementById("canvas3");
var context3 = canvas3.getContext("2d");
var outlineImage3 = new Image();
outlineImage3.src = a[2][4];
context3.drawImage(outlineImage3, 0, 0, 224, 224);
canvas3.clickX = new Array();
canvas3.clickY = new Array();
canvas3.clickDrag = new Array();
canvas3.clickSize = new Array();
canvas3.curSize = "normal";
var paint3;
canvas3.addEventListener("mousedown",function(e){
paint3 = true;
addClick(e.pageX - this.offsetLeft, e.pageY - this.offsetTop, false, this.clickX, this.clickY,this.clickDrag,this.clickSize,this.curSize);
redraw(this.clickX, this.clickY, context3, this.clickDrag,this.clickSize);
});
canvas3.addEventListener("mousemove",function(e){
if(paint3){
addClick(e.pageX - this.offsetLeft, e.pageY - this.offsetTop, true, this.clickX, this.clickY,this.clickDrag,this.clickSize,this.curSize);
redraw(this.clickX, this.clickY, context3,this.clickDrag,this.clickSize);
}
});
canvas3.addEventListener("mouseup",function(e){
paint3 = false;
});
canvas3.addEventListener("mouseleave",function(e){
paint3 = false;
});
var canvas4 = document.getElementById("canvas4");
var context4 = canvas4.getContext("2d");
var outlineImage4 = new Image();
outlineImage4.src = a[3][4];
context4.drawImage(outlineImage4, 0, 0, 224, 224);
canvas4.clickX = new Array();
canvas4.clickY = new Array();
canvas4.clickDrag = new Array();
canvas4.clickSize = new Array();
canvas4.curSize = "normal";
var paint4;
canvas4.addEventListener("mousedown",function(e){
paint4 = true;
addClick(e.pageX - this.offsetLeft, e.pageY - this.offsetTop, false, this.clickX, this.clickY,this.clickDrag,this.clickSize,this.curSize);
redraw(this.clickX, this.clickY, context4, this.clickDrag,this.clickSize);
});
canvas4.addEventListener("mousemove",function(e){
if(paint4){
addClick(e.pageX - this.offsetLeft, e.pageY - this.offsetTop, true, this.clickX, this.clickY,this.clickDrag,this.clickSize,this.curSize);
redraw(this.clickX, this.clickY, context4,this.clickDrag,this.clickSize);
}
});
canvas4.addEventListener("mouseup",function(e){
paint4 = false;
});
canvas4.addEventListener("mouseleave",function(e){
paint4 = false;
});
var canvas5 = document.getElementById("canvas5");
var context5 = canvas5.getContext("2d");
var outlineImage5 = new Image();
outlineImage5.src = a[4][4];
context5.drawImage(outlineImage5, 0, 0, 224, 224);
canvas5.clickX = new Array();
canvas5.clickY = new Array();
canvas5.clickDrag = new Array();
canvas5.clickSize = new Array();
canvas5.curSize = "normal";
var paint5;
canvas5.addEventListener("mousedown",function(e){
paint5 = true;
addClick(e.pageX - this.offsetLeft, e.pageY - this.offsetTop, false, this.clickX, this.clickY,this.clickDrag,this.clickSize,this.curSize);
redraw(this.clickX, this.clickY, context5, this.clickDrag,this.clickSize);
});
canvas5.addEventListener("mousemove",function(e){
if(paint5){
addClick(e.pageX - this.offsetLeft, e.pageY - this.offsetTop, true, this.clickX, this.clickY,this.clickDrag,this.clickSize,this.curSize);
redraw(this.clickX, this.clickY, context5,this.clickDrag,this.clickSize);
}
});
canvas5.addEventListener("mouseup",function(e){
paint5 = false;
});
canvas5.addEventListener("mouseleave",function(e){
paint5 = false;
});
var canvas6 = document.getElementById("canvas6");
var context6 = canvas6.getContext("2d");
var outlineImage6 = new Image();
outlineImage6.src = a[5][4];
context6.drawImage(outlineImage6, 0, 0, 224, 224);
canvas6.clickX = new Array();
canvas6.clickY = new Array();
canvas6.clickDrag = new Array();
canvas6.clickSize = new Array();
canvas6.curSize = "normal";
var paint6;
canvas6.addEventListener("mousedown",function(e){
paint6 = true;
addClick(e.pageX - this.offsetLeft, e.pageY - this.offsetTop, false, this.clickX, this.clickY,this.clickDrag,this.clickSize,this.curSize);
redraw(this.clickX, this.clickY, context6, this.clickDrag,this.clickSize);
});
canvas6.addEventListener("mousemove",function(e){
if(paint6){
addClick(e.pageX - this.offsetLeft, e.pageY - this.offsetTop, true, this.clickX, this.clickY,this.clickDrag,this.clickSize,this.curSize);
redraw(this.clickX, this.clickY, context6,this.clickDrag,this.clickSize);
}
});
canvas6.addEventListener("mouseup",function(e){
paint6 = false;
});
canvas6.addEventListener("mouseleave",function(e){
paint6 = false;
});
var canvas7 = document.getElementById("canvas7");
var context7 = canvas7.getContext("2d");
var outlineImage7 = new Image();
outlineImage7.src = a[6][4];
context7.drawImage(outlineImage7, 0, 0, 224, 224);
canvas7.clickX = new Array();
canvas7.clickY = new Array();
canvas7.clickDrag = new Array();
canvas7.clickSize = new Array();
canvas7.curSize = "normal";
var paint7;
canvas7.addEventListener("mousedown",function(e){
paint7 = true;
addClick(e.pageX - this.offsetLeft, e.pageY - this.offsetTop, false, this.clickX, this.clickY,this.clickDrag,this.clickSize,this.curSize);
redraw(this.clickX, this.clickY, context7, this.clickDrag,this.clickSize);
});
canvas7.addEventListener("mousemove",function(e){
if(paint7){
addClick(e.pageX - this.offsetLeft, e.pageY - this.offsetTop, true, this.clickX, this.clickY,this.clickDrag,this.clickSize,this.curSize);
redraw(this.clickX, this.clickY, context7,this.clickDrag,this.clickSize);
}
});
canvas7.addEventListener("mouseup",function(e){
paint7 = false;
});
canvas7.addEventListener("mouseleave",function(e){
paint7 = false;
});
var canvas8 = document.getElementById("canvas8");
var context8 = canvas8.getContext("2d");
var outlineImage8 = new Image();
outlineImage8.src = a[7][4];
context8.drawImage(outlineImage8, 0, 0, 224, 224);
canvas8.clickX = new Array();
canvas8.clickY = new Array();
canvas8.clickDrag = new Array();
canvas8.clickSize = new Array();
canvas8.curSize = "normal";
var paint8;
canvas8.addEventListener("mousedown",function(e){
paint8 = true;
addClick(e.pageX - this.offsetLeft, e.pageY - this.offsetTop, false, this.clickX, this.clickY,this.clickDrag,this.clickSize,this.curSize);
redraw(this.clickX, this.clickY, context8, this.clickDrag,this.clickSize);
});
canvas8.addEventListener("mousemove",function(e){
if(paint8){
addClick(e.pageX - this.offsetLeft, e.pageY - this.offsetTop, true, this.clickX, this.clickY,this.clickDrag,this.clickSize,this.curSize);
redraw(this.clickX, this.clickY, context8,this.clickDrag,this.clickSize);
}
});
canvas8.addEventListener("mouseup",function(e){
paint8 = false;
});
var canvas9 = document.getElementById("canvas9");
var context9 = canvas9.getContext("2d");
var outlineImage9 = new Image();
outlineImage9.src = a[8][4];
context9.drawImage(outlineImage9, 0, 0, 224, 224);
canvas9.clickX = new Array();
canvas9.clickY = new Array();
canvas9.clickDrag = new Array();
canvas9.clickSize = new Array();
canvas9.curSize = "normal";
var paint9;
canvas9.addEventListener("mousedown",function(e){
paint9 = true;
addClick(e.pageX - this.offsetLeft, e.pageY - this.offsetTop, false, this.clickX, this.clickY,this.clickDrag,this.clickSize,this.curSize);
redraw(this.clickX, this.clickY, context9, this.clickDrag,this.clickSize);
});
canvas9.addEventListener("mousemove",function(e){
if(paint9){
addClick(e.pageX - this.offsetLeft, e.pageY - this.offsetTop, true, this.clickX, this.clickY,this.clickDrag,this.clickSize,this.curSize);
redraw(this.clickX, this.clickY, context9,this.clickDrag,this.clickSize);
}
});
canvas9.addEventListener("mouseup",function(e){
paint9 = false;
});
canvas9.addEventListener("mouseleave",function(e){
paint9 = false;
});
var canvas10 = document.getElementById("canvas10");
var context10 = canvas10.getContext("2d");
var outlineImage10 = new Image();
outlineImage10.src = a[9][4];
context10.drawImage(outlineImage10, 0, 0, 224, 224);
canvas10.clickX = new Array();
canvas10.clickY = new Array();
canvas10.clickDrag = new Array();
canvas10.clickSize = new Array();
canvas10.curSize = "normal";
var paint10;
canvas10.addEventListener("mousedown",function(e){
paint10 = true;
addClick(e.pageX - this.offsetLeft, e.pageY - this.offsetTop, false, this.clickX, this.clickY,this.clickDrag,this.clickSize,this.curSize);
redraw(this.clickX, this.clickY, context10, this.clickDrag,this.clickSize);
});
canvas10.addEventListener("mousemove",function(e){
if(paint10){
addClick(e.pageX - this.offsetLeft, e.pageY - this.offsetTop, true, this.clickX, this.clickY,this.clickDrag,this.clickSize,this.curSize);
redraw(this.clickX, this.clickY, context10,this.clickDrag,this.clickSize);
}
});
canvas10.addEventListener("mouseup",function(e){
paint10 = false;
});
canvas10.addEventListener("mouseleave",function(e){
paint10 = false;
});
var canvas11 = document.getElementById("canvas11");
var context11 = canvas11.getContext("2d");
var outlineImage11 = new Image();
outlineImage11.src = a[10][4];
context11.drawImage(outlineImage11, 0, 0, 224, 224);
canvas11.clickX = new Array();
canvas11.clickY = new Array();
canvas11.clickDrag = new Array();
canvas11.clickSize = new Array();
canvas11.curSize = "normal";
var paint11;
canvas11.addEventListener("mousedown",function(e){
paint11 = true;
addClick(e.pageX - this.offsetLeft, e.pageY - this.offsetTop, false, this.clickX, this.clickY,this.clickDrag,this.clickSize,this.curSize);
redraw(this.clickX, this.clickY, context11, this.clickDrag,this.clickSize);
});
canvas11.addEventListener("mousemove",function(e){
if(paint11){
addClick(e.pageX - this.offsetLeft, e.pageY - this.offsetTop, true, this.clickX, this.clickY,this.clickDrag,this.clickSize,this.curSize);
redraw(this.clickX, this.clickY, context11,this.clickDrag,this.clickSize);
}
});
canvas11.addEventListener("mouseup",function(e){
paint11 = false;
});
canvas11.addEventListener("mouseleave",function(e){
paint11 = false;
});
var canvas12 = document.getElementById("canvas12");
var context12 = canvas12.getContext("2d");
var outlineImage12 = new Image();
outlineImage12.src = a[11][4];
context12.drawImage(outlineImage12, 0, 0, 224, 224);
canvas12.clickX = new Array();
canvas12.clickY = new Array();
canvas12.clickDrag = new Array();
canvas12.clickSize = new Array();
canvas12.curSize = "normal";
var paint12;
canvas12.addEventListener("mousedown",function(e){
paint12 = true;
addClick(e.pageX - this.offsetLeft, e.pageY - this.offsetTop, false, this.clickX, this.clickY,this.clickDrag,this.clickSize,this.curSize);
redraw(this.clickX, this.clickY, context12, this.clickDrag,this.clickSize);
});
canvas12.addEventListener("mousemove",function(e){
if(paint12){
addClick(e.pageX - this.offsetLeft, e.pageY - this.offsetTop, true, this.clickX, this.clickY,this.clickDrag,this.clickSize,this.curSize);
redraw(this.clickX, this.clickY, context12,this.clickDrag,this.clickSize);
}
});
canvas12.addEventListener("mouseup",function(e){
paint12 = false;
});
canvas12.addEventListener("mouseleave",function(e){
paint12 = false;
});
var canvas13 = document.getElementById("canvas13");
var context13 = canvas13.getContext("2d");
var outlineImage13 = new Image();
outlineImage13.src = a[12][4];
context13.drawImage(outlineImage13, 0, 0, 224, 224);
canvas13.clickX = new Array();
canvas13.clickY = new Array();
canvas13.clickDrag = new Array();
canvas13.clickSize = new Array();
canvas13.curSize = "normal";
var paint13;
canvas13.addEventListener("mousedown",function(e){
paint13 = true;
addClick(e.pageX - this.offsetLeft, e.pageY - this.offsetTop, false, this.clickX, this.clickY,this.clickDrag,this.clickSize,this.curSize);
redraw(this.clickX, this.clickY, context13, this.clickDrag,this.clickSize);
});
canvas13.addEventListener("mousemove",function(e){
if(paint13){
addClick(e.pageX - this.offsetLeft, e.pageY - this.offsetTop, true, this.clickX, this.clickY,this.clickDrag,this.clickSize,this.curSize);
redraw(this.clickX, this.clickY, context13,this.clickDrag,this.clickSize);
}
});
canvas13.addEventListener("mouseup",function(e){
paint13 = false;
});
canvas13.addEventListener("mouseleave",function(e){
paint13 = false;
});
var canvas14 = document.getElementById("canvas14");
var context14 = canvas14.getContext("2d");
var outlineImage14 = new Image();
outlineImage14.src = a[13][4];
context14.drawImage(outlineImage14, 0, 0, 224, 224);
canvas14.clickX = new Array();
canvas14.clickY = new Array();
canvas14.clickDrag = new Array();
canvas14.clickSize = new Array();
canvas14.curSize = "normal";
var paint14;
canvas14.addEventListener("mousedown",function(e){
paint14 = true;
addClick(e.pageX - this.offsetLeft, e.pageY - this.offsetTop, false, this.clickX, this.clickY,this.clickDrag,this.clickSize,this.curSize);
redraw(this.clickX, this.clickY, context14, this.clickDrag,this.clickSize);
});
canvas14.addEventListener("mousemove",function(e){
if(paint14){
addClick(e.pageX - this.offsetLeft, e.pageY - this.offsetTop, true, this.clickX, this.clickY,this.clickDrag,this.clickSize,this.curSize);
redraw(this.clickX, this.clickY, context14,this.clickDrag,this.clickSize);
}
});
canvas14.addEventListener("mouseup",function(e){
paint14 = false;
});
canvas14.addEventListener("mouseleave",function(e){
paint14 = false;
});
var canvas15 = document.getElementById("canvas15");
var context15 = canvas15.getContext("2d");
var outlineImage15 = new Image();
outlineImage15.src = a[14][4];
context15.drawImage(outlineImage15, 0, 0, 224, 224);
canvas15.clickX = new Array();
canvas15.clickY = new Array();
canvas15.clickDrag = new Array();
canvas15.clickSize = new Array();
canvas15.curSize = "normal";
var paint15;
canvas15.addEventListener("mousedown",function(e){
paint15 = true;
addClick(e.pageX - this.offsetLeft, e.pageY - this.offsetTop, false, this.clickX, this.clickY,this.clickDrag,this.clickSize,this.curSize);
redraw(this.clickX, this.clickY, context15, this.clickDrag,this.clickSize);
});
canvas15.addEventListener("mousemove",function(e){
if(paint15){
addClick(e.pageX - this.offsetLeft, e.pageY - this.offsetTop, true, this.clickX, this.clickY,this.clickDrag,this.clickSize,this.curSize);
redraw(this.clickX, this.clickY, context15,this.clickDrag,this.clickSize);
}
});
canvas15.addEventListener("mouseup",function(e){
paint15 = false;
});
canvas15.addEventListener("mouseleave",function(e){
paint15 = false;
});
var canvas16 = document.getElementById("canvas16");
var context16 = canvas16.getContext("2d");
var outlineImage16 = new Image();
outlineImage16.src = a[15][4];
context16.drawImage(outlineImage16, 0, 0, 224, 224);
canvas16.clickX = new Array();
canvas16.clickY = new Array();
canvas16.clickDrag = new Array();
canvas16.clickSize = new Array();
canvas16.curSize = "normal";
var paint16;
canvas16.addEventListener("mousedown",function(e){
paint16 = true;
addClick(e.pageX - this.offsetLeft, e.pageY - this.offsetTop, false, this.clickX, this.clickY,this.clickDrag,this.clickSize,this.curSize);
redraw(this.clickX, this.clickY, context16, this.clickDrag,this.clickSize);
});
canvas16.addEventListener("mousemove",function(e){
if(paint16){
addClick(e.pageX - this.offsetLeft, e.pageY - this.offsetTop, true, this.clickX, this.clickY,this.clickDrag,this.clickSize,this.curSize);
redraw(this.clickX, this.clickY, context16,this.clickDrag,this.clickSize);
}
});
canvas16.addEventListener("mouseup",function(e){
paint16 = false;
});
canvas16.addEventListener("mouseleave",function(e){
paint16 = false;
});
var canvas17 = document.getElementById("canvas17");
var context17 = canvas17.getContext("2d");
var outlineImage17 = new Image();
outlineImage17.src = a[16][4];
context17.drawImage(outlineImage17, 0, 0, 224, 224);
canvas17.clickX = new Array();
canvas17.clickY = new Array();
canvas17.clickDrag = new Array();
canvas17.clickSize = new Array();
canvas17.curSize = "normal";
var paint17;
canvas17.addEventListener("mousedown",function(e){
paint17 = true;
addClick(e.pageX - this.offsetLeft, e.pageY - this.offsetTop, false, this.clickX, this.clickY,this.clickDrag,this.clickSize,this.curSize);
redraw(this.clickX, this.clickY, context17, this.clickDrag,this.clickSize);
});
canvas17.addEventListener("mousemove",function(e){
if(paint17){
addClick(e.pageX - this.offsetLeft, e.pageY - this.offsetTop, true, this.clickX, this.clickY,this.clickDrag,this.clickSize,this.curSize);
redraw(this.clickX, this.clickY, context17,this.clickDrag,this.clickSize);
}
});
canvas17.addEventListener("mouseup",function(e){
paint17 = false;
});
canvas17.addEventListener("mouseleave",function(e){
paint17 = false;
});
var canvas18 = document.getElementById("canvas18");
var context18 = canvas18.getContext("2d");
var outlineImage18 = new Image();
outlineImage18.src = a[17][4];
context18.drawImage(outlineImage18, 0, 0, 224, 224);
canvas18.clickX = new Array();
canvas18.clickY = new Array();
canvas18.clickDrag = new Array();
canvas18.clickSize = new Array();
canvas18.curSize = "normal";
var paint18;
canvas18.addEventListener("mousedown",function(e){
paint18 = true;
addClick(e.pageX - this.offsetLeft, e.pageY - this.offsetTop, false, this.clickX, this.clickY,this.clickDrag,this.clickSize,this.curSize);
redraw(this.clickX, this.clickY, context18, this.clickDrag,this.clickSize);
});
canvas18.addEventListener("mousemove",function(e){
if(paint18){
addClick(e.pageX - this.offsetLeft, e.pageY - this.offsetTop, true, this.clickX, this.clickY,this.clickDrag,this.clickSize,this.curSize);
redraw(this.clickX, this.clickY, context18,this.clickDrag,this.clickSize);
}
});
canvas18.addEventListener("mouseup",function(e){
paint18 = false;
});
canvas18.addEventListener("mouseleave",function(e){
paint18 = false;
});
var canvas19 = document.getElementById("canvas19");
var context19 = canvas19.getContext("2d");
var outlineImage19 = new Image();
outlineImage19.src = a[18][4];
context19.drawImage(outlineImage19, 0, 0, 224, 224);
canvas19.clickX = new Array();
canvas19.clickY = new Array();
canvas19.clickDrag = new Array();
canvas19.clickSize = new Array();
canvas19.curSize = "normal";
var paint19;
canvas19.addEventListener("mousedown",function(e){
paint19 = true;
addClick(e.pageX - this.offsetLeft, e.pageY - this.offsetTop, false, this.clickX, this.clickY,this.clickDrag,this.clickSize,this.curSize);
redraw(this.clickX, this.clickY, context19, this.clickDrag,this.clickSize);
});
canvas19.addEventListener("mousemove",function(e){
if(paint19){
addClick(e.pageX - this.offsetLeft, e.pageY - this.offsetTop, true, this.clickX, this.clickY,this.clickDrag,this.clickSize,this.curSize);
redraw(this.clickX, this.clickY, context19,this.clickDrag,this.clickSize);
}
});
canvas19.addEventListener("mouseup",function(e){
paint19 = false;
});
canvas19.addEventListener("mouseleave",function(e){
paint19 = false;
});
var canvas20 = document.getElementById("canvas20");
var context20 = canvas20.getContext("2d");
var outlineImage20 = new Image();
outlineImage20.src = a[19][4];
context20.drawImage(outlineImage20, 0, 0, 224, 224);
canvas20.clickX = new Array();
canvas20.clickY = new Array();
canvas20.clickDrag = new Array();
canvas20.clickSize = new Array();
canvas20.curSize = "normal";
var paint20;
canvas20.addEventListener("mousedown",function(e){
paint20 = true;
addClick(e.pageX - this.offsetLeft, e.pageY - this.offsetTop, false, this.clickX, this.clickY,this.clickDrag,this.clickSize,this.curSize);
redraw(this.clickX, this.clickY, context20, this.clickDrag,this.clickSize);
});
canvas20.addEventListener("mousemove",function(e){
if(paint20){
addClick(e.pageX - this.offsetLeft, e.pageY - this.offsetTop, true, this.clickX, this.clickY,this.clickDrag,this.clickSize,this.curSize);
redraw(this.clickX, this.clickY, context20,this.clickDrag,this.clickSize);
}
});
canvas20.addEventListener("mouseup",function(e){
paint20 = false;
});
canvas20.addEventListener("mouseleave",function(e){
paint20 = false;
});
/* function to add information to given canvas' arrays of click information */
function addClick(x, y, dragging, clickX, clickY,clickDrag,clickSize,curSize) {
clickX.push(x);
clickY.push(y);
clickDrag.push(dragging);
clickSize.push(curSize);
}
/* function to redraw lines drawn on given canvas so far */
function redraw(clickX, clickY,context,clickDrag,clickSize) {
context.lineJoin = "round";
context.strokeStyle = "#FF0000";
var radius;
for(var i=0; i < clickX.length; i++) {
if(clickSize[i] == "small"){
radius = 5;
} else if(clickSize[i] == "normal"){
radius = 10;
} else if(clickSize[i] == "large"){
radius = 20;
} else if(clickSize[i] == "huge"){
radius = 40;
} else{
alert("Error: Radius is zero for click " + i);
radius = 0;
}
context.beginPath();
if(clickDrag[i] && i){
context.moveTo(clickX[i-1], clickY[i-1]);
} else{
context.moveTo(clickX[i]-1, clickY[i]);
}
context.lineTo(clickX[i], clickY[i]);
context.closePath();
context.lineWidth = radius;
context.stroke();
}
}
});
/* function to clear drawing from given canvas */
function clearCanvas(i)
{
var canvas = document.getElementById("canvas"+i.toString());
var context = canvas.getContext("2d");
context.clearRect(0, 0, 224, 224);
var outlineImage = new Image();
outlineImage.src = a[i-1][4];
context.drawImage(outlineImage, 0, 0, 224, 224);
canvas.clickX = new Array();
canvas.clickY = new Array();
canvas.clickDrag = new Array();
canvas.clickSize = new Array();
canvas.curSize = "normal";
}
/* function to set drawing size of canvas to small, normal, large, or huge */
function drawSize(i,s) {
var canvas = document.getElementById("canvas"+i.toString());
canvas.curSize = s;
}
/* function to make canvas for given question appear */
function myFunction(i) {
var elements = document.getElementsByClassName('canvasDiv');
var requiredElement = elements[0];
requiredElement.classList.remove("canvasDiv");
requiredElement.classList.add("showd");
clearCanvas(i+1); /* ensures image appears, without this a bug occurs so that the image does not appear */
}
/* function to make given confidence slider appear */
function myFunction0(i) {
var requiredElement = document.getElementById('slider'+i.toString());
requiredElement.classList.remove("hideddd");
requiredElement.classList.add("showeddd");
}
/* function to make given next element of survey appear */
function myFunction2(i) {
var elements = document.getElementsByClassName('hided');
var requiredElement = elements[i];
requiredElement.classList.remove("hided");
requiredElement.classList.add("showed");
var current = document.getElementsByClassName('showed');
var requiredCurrent = current[0];
requiredCurrent.classList.remove("showed");
requiredCurrent.classList.add("hided");
}
/* function to make first element of survey disappear and second element of survey appear */
function myFunction3() {
var element = document.getElementsByClassName('bye');
var requiredElement = element[0];
requiredElement.classList.remove("bye");
requiredElement.classList.add("showed");
var current = document.getElementsByClassName('hi');
var requiredCurrent = current[0];
requiredCurrent.classList.remove("hi");
requiredCurrent.classList.add("bye");
}
/* function to make confidence slider's input number shown update in real time. function also makes follow-up "Continue" button appear. */
function updateTextInput(val,n) {
document.getElementById('textInput'+ n.toString()).value=val;
var requiredElement = document.getElementById('hidedd'+n.toString());
requiredElement.classList.remove("hidedd");
requiredElement.classList.add("showedd");
}
/* function to make given "Continue" button element appear */
function myFunction1() {
var elements = document.getElementsByClassName('hidedd');
var requiredElement = elements[0];
requiredElement.classList.remove("hidedd");
requiredElement.classList.add("showedd");
}
/* function to make first "Continue" button appear */
function begin() {
var elements = document.getElementsByClassName('bye2');
var requiredElement = elements[0];
requiredElement.classList.remove("bye2");
requiredElement.classList.add("hi2");
}
</script>
</head>
<body>
<form name='mturk_form' method='post' id='mturk_form' action='https://www.mturk.com/mturk/externalSubmit'><input type='hidden' value='' name='assignmentId' id='assignmentId'/>
<fieldset class="hi">
<div><strong>Instructions</strong></div>
<div>
<ul>
<li>You will be working with an AI bot, as a team, to classify images.</li>
<li>You will be asked to to classify 20 images twice.</li>
<li>For each image, you will first classify it without any additional information, and you will provide your confidence in your answer using a slider as well as your visual explanation of your choice by highlighting the portion of the image that helped you to make your choice. Afterward, you will be given the AI bot's answer, its confidence in its answer, and a visual explanation of its answer. With this new information, you will be asked to make a final classification of the image.</li>
<li>The team's final answer will be determined based on an equal weighting of your final answer and the AI bot's final answer.</li>
<li>You may not return to any question, so please choose your answers carefully.</li>
</ul>
</div>
<!-- Preliminary Questions -->
<p>Please answer the following question before beginning the classification task.</p>
<p>What level of knowledge do you have about different bird species?</p>
<div class="radio"><input name="Q0Answer" type="radio" value="very high" id="in01" onclick="begin()"/><label for="in01" id="op01">very high</label></div>
<div class="radio"><input name="Q0Answer" type="radio" value="high" id="in02" onclick="begin()"/><label for="in02" id="op02">high</label></div>
<div class="radio"><input name="Q0Answer" type="radio" value="medium" id="in03" onclick="begin()"/><label for="in03" id="op03">medium</label></div>
<div class="radio"><input name="Q0Answer" type="radio" value="low" id="in04" onclick="begin()"/><label for="in04" id="op04">low</label></div>
<div class="radio"><input name="Q0Answer" type="radio" value="very low" id="in05" onclick="begin()"/><label for="in05" id="op05">very low</label></div>
<button type="button" class="bye2" onclick="myFunction3()">Continue</button>
</fieldset>
<!-- Original Image Question 1 -->
<fieldset class="bye">
<p>Please categorize the image below.</p>
<img id="i1" src="">
<div class="radio"><input name="Q1Answer" type="radio" value="" id="in1" onclick="myFunction(0)"/><label for="in1" id="op1"></label></div>
<div class="radio"><input name="Q1Answer" type="radio" value="" id="in2" onclick="myFunction(0)"/><label for="in2" id="op2"></label></div>
<div class="radio"><input name="Q1Answer" type="radio" value="" id="in3" onclick="myFunction(0)"/><label for="in3" id="op3"></label></div>
<div class="radio"><input name="Q1Answer" type="radio" value="" id="in4" onclick="myFunction(0)"/><label for="in4" id="op4"></label></div>
<div class="canvasDiv">
<p>Please highlight the part of the image that led you to make your choice.</p>
<canvas id="canvas1" width="224" height="224" onmousedown="myFunction0(1)"></canvas>
<div>
Marker Size: <button type="button" onclick="drawSize(1,'small')">Small</button>
<button type="button" onclick="drawSize(1,'normal')">Normal</button>
<button type="button" onclick="drawSize(1,'large')">Large</button>
<button type="button" onclick="drawSize(1,'huge')">Huge</button>
</div>
<div><button type="button" onclick="clearCanvas(1)">Clear</button></div>
</div>
<div id="slider1" class="hideddd">
Confidence: <input type="range" name="rangeInput" min="0" max="100" oninput="updateTextInput(this.value,0);">
<input type="text" style="width: 18px" id="textInput0" value="" disabled="disabled">
</div>
<button type="button" id="hidedd0" class="hidedd" onclick="myFunction2(0)">Continue</button>
</fieldset>
<!-- Visual Explanation Image Question 1 -->
<fieldset class="hided">
<p id="r1"></p>
<img id="i2" src="">
<div class="radio"><input name="Q2Answer" type="radio" value="" id="in5" onclick="myFunction0(2)"/><label for="in5" id="op5"></label></div>
<div class="radio"><input name="Q2Answer" type="radio" value="" id="in6" onclick="myFunction0(2)"/><label for="in6" id="op6"></label></div>
<div class="radio"><input name="Q2Answer" type="radio" value="" id="in7" onclick="myFunction0(2)"/><label for="in7" id="op7"></label></div>
<div class="radio"><input name="Q2Answer" type="radio" value="" id="in8" onclick="myFunction0(2)"/><label for="in8" id="op8"></label></div>
<div id="slider2" class="hideddd">
Confidence: <input type="range" name="rangeInput" min="0" max="100" oninput="updateTextInput(this.value,1);">
<input type="text" style="width: 18px" id="textInput1" value="" disabled="disabled">
</div>
<button type="button" id="hidedd1" class="hidedd" onclick="myFunction2(1)">Continue</button>
</fieldset>
<!-- Feedback for Question 1 -->
<fieldset class="hided">
<p id="f1"></p>
<button type="button" onclick="myFunction2(2)">Continue</button>
</fieldset>
<!-- Original Image Question 2 -->
<fieldset class="hided">
<p>Please categorize the image below.</p>
<img id="i3" src="">
<div class="radio"><input name="Q3Answer" type="radio" value="" id="in9" onclick="myFunction(1)"/><label for="in9" id="op9"></label></div>
<div class="radio"><input name="Q3Answer" type="radio" value="" id="in10" onclick="myFunction(1)"/><label for="in10" id="op10"></label></div>
<div class="radio"><input name="Q3Answer" type="radio" value="" id="in11" onclick="myFunction(1)"/><label for="in11" id="op11"></label></div>
<div class="radio"><input name="Q3Answer" type="radio" value="" id="in12" onclick="myFunction(1)"/><label for="in12" id="op12"></label></div>
<div class="canvasDiv">
<p>Please highlight the part of the image that led you to make your choice.</p>
<canvas id="canvas2" width="224" height="224" onmousedown="myFunction0(3)"></canvas>
<div>
Marker Size: <button type="button" onclick="drawSize(2,'small')">Small</button>
<button type="button" onclick="drawSize(2,'normal')">Normal</button>
<button type="button" onclick="drawSize(2,'large')">Large</button>
<button type="button" onclick="drawSize(2,'huge')">Huge</button>
</div>
<div><button type="button" onclick="clearCanvas(2)">Clear</button></div>
</div>