Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
O
Object_Segments_CNN
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mohammadHossein
Object_Segments_CNN
Commits
4e99d0ab
Commit
4e99d0ab
authored
Sep 09, 2021
by
mohammadHossein
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
variable initialized at beggining routine.
parent
710380bd
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
971 additions
and
285 deletions
+971
-285
Object_Segments_CNN-legacy-browsers.js
Object_Segments_CNN-legacy-browsers.js
+158
-141
Object_Segments_CNN.js
Object_Segments_CNN.js
+158
-141
Object_Segments_CNN.psyexp
Object_Segments_CNN.psyexp
+21
-1
Object_Segments_CNN_lastrun.py
Object_Segments_CNN_lastrun.py
+56
-2
001_Object_Segments_CNN_2021_Aug_12_0022.csv
data/001_Object_Segments_CNN_2021_Aug_12_0022.csv
+1
-0
001_Object_Segments_CNN_2021_Aug_12_0022.log
data/001_Object_Segments_CNN_2021_Aug_12_0022.log
+65
-0
001_Object_Segments_CNN_2021_Aug_12_0022.psydat
data/001_Object_Segments_CNN_2021_Aug_12_0022.psydat
+0
-0
001_Object_Segments_CNN_2021_Sep_09_2114.csv
data/001_Object_Segments_CNN_2021_Sep_09_2114.csv
+7
-0
001_Object_Segments_CNN_2021_Sep_09_2114.log
data/001_Object_Segments_CNN_2021_Sep_09_2114.log
+186
-0
001_Object_Segments_CNN_2021_Sep_09_2114.psydat
data/001_Object_Segments_CNN_2021_Sep_09_2114.psydat
+0
-0
001_Object_Segments_CNN_2021_Sep_10_0111.csv
data/001_Object_Segments_CNN_2021_Sep_10_0111.csv
+15
-0
001_Object_Segments_CNN_2021_Sep_10_0111.log
data/001_Object_Segments_CNN_2021_Sep_10_0111.log
+304
-0
001_Object_Segments_CNN_2021_Sep_10_0111.psydat
data/001_Object_Segments_CNN_2021_Sep_10_0111.psydat
+0
-0
No files found.
Object_Segments_CNN-legacy-browsers.js
View file @
4e99d0ab
...
...
@@ -8,6 +8,33 @@ let expName = 'Object_Segments_CNN'; // from the Builder filename that created
let
expInfo
=
{
'session'
:
'001'
,
'participant'
:
'001'
};
// Start code blocks for 'Before Experiment'
training_list
=
[];
classes_labels
=
[
"car"
,
"elephant"
,
"fish"
,
"hammer"
,
"hand_blower"
,
"hat"
,
"iron"
,
"ladybug"
,
"pineapple"
,
"pot"
,
"sewing_machine"
,
"violin"
];
masked_images_dir
=
"images_dir/masked_datasets/"
;
unmasked_images_dir
=
"images_dir/unmasked_datasets/"
;
range_dict
=
{};
for
(
var
item
,
_pj_c
=
0
,
_pj_a
=
classes_labels
,
_pj_b
=
_pj_a
.
length
;
(
_pj_c
<
_pj_b
);
_pj_c
+=
1
)
{
item
=
_pj_a
[
_pj_c
];
range_list_str
=
os
.
listdir
((
masked_images_dir
+
item
));
range_list_int
=
function
()
{
var
_pj_d
=
[],
_pj_e
=
range_list_str
;
for
(
var
_pj_f
=
0
,
_pj_g
=
_pj_e
.
length
;
(
_pj_f
<
_pj_g
);
_pj_f
+=
1
)
{
var
i
=
_pj_e
[
_pj_f
];
_pj_d
.
push
(
Number
.
parseInt
(
i
));
}
return
_pj_d
;
}
.
call
(
this
);
range_list_int
.
sort
();
range_dict
.
update
({[
item
]:
range_list_int
});
}
images_dict
=
{};
for
(
var
element
,
_pj_c
=
0
,
_pj_a
=
classes_labels
,
_pj_b
=
_pj_a
.
length
;
(
_pj_c
<
_pj_b
);
_pj_c
+=
1
)
{
element
=
_pj_a
[
_pj_c
];
images_dict
.
update
({[
element
]:
[[],
0
]});
}
// init psychoJS:
const
psychoJS
=
new
PsychoJS
({
debug
:
true
...
...
@@ -67,8 +94,6 @@ psychoJS.start({
psychoJS
.
experimentLogger
.
setLevel
(
core
.
Logger
.
ServerLevel
.
EXP
);
var
frameDur
;
async
function
updateInfo
()
{
expInfo
[
'date'
]
=
util
.
MonotonicClock
.
getDateStr
();
// add a simple timestamp
expInfo
[
'expName'
]
=
expName
;
...
...
@@ -88,70 +113,6 @@ async function updateInfo() {
return
Scheduler
.
Event
.
NEXT
;
}
var
AckClock
;
var
Acknowledgement
;
var
key_resp1
;
var
Training_IntroClock
;
var
text
;
var
key_resp
;
var
masked_trainingClock
;
var
image
;
var
text_2
;
var
key_resp_2
;
var
Answer_trainingClock
;
var
text_7
;
var
fish
;
var
hammer
;
var
elephant
;
var
Pineapple
;
var
pot
;
var
Hat
;
var
iron
;
var
hand_blower
;
var
Violin
;
var
sewing_machine
;
var
Car
;
var
Ladybug
;
var
idk
;
var
unmasked_trainingClock
;
var
image_4
;
var
key_resp_8
;
var
text_8
;
var
text_10
;
var
Testing_IntroClock
;
var
text_3
;
var
key_resp_4
;
var
catch_trialClock
;
var
Im_readyClock
;
var
text_11
;
var
key_resp_9
;
var
test_maskClock
;
var
image_2
;
var
key_resp_5
;
var
answer_sheetClock
;
var
text_9
;
var
fish_2
;
var
hammer_2
;
var
elephant_2
;
var
Pineapple_2
;
var
pot_2
;
var
Hat_2
;
var
iron_2
;
var
hand_blower_2
;
var
Violin_2
;
var
sewing_machine_2
;
var
Car_2
;
var
Ladybug_2
;
var
idk_2
;
var
Rest_after_blockClock
;
var
text_5
;
var
key_resp_7
;
var
Final_messageClock
;
var
text_6
;
var
key_resp_3
;
var
globalClock
;
var
routineTimer
;
async
function
experimentInit
()
{
// Initialize components for Routine "Ack"
AckClock
=
new
util
.
Clock
();
...
...
@@ -584,12 +545,6 @@ async function experimentInit() {
return
Scheduler
.
Event
.
NEXT
;
}
var
t
;
var
frameN
;
var
continueRoutine
;
var
_key_resp1_allKeys
;
var
AckComponents
;
function
AckRoutineBegin
(
snapshot
)
{
return
async
function
()
{
TrialHandler
.
fromSnapshot
(
snapshot
);
// ensure that .thisN vals are up to date
...
...
@@ -616,7 +571,6 @@ function AckRoutineBegin(snapshot) {
}
}
function
AckRoutineEachFrame
()
{
return
async
function
()
{
//------Loop for each frame of Routine 'Ack'-------
...
...
@@ -684,7 +638,6 @@ function AckRoutineEachFrame() {
};
}
function
AckRoutineEnd
()
{
return
async
function
()
{
//------Ending Routine 'Ack'-------
...
...
@@ -701,9 +654,6 @@ function AckRoutineEnd() {
};
}
var
_key_resp_allKeys
;
var
Training_IntroComponents
;
function
Training_IntroRoutineBegin
(
snapshot
)
{
return
async
function
()
{
TrialHandler
.
fromSnapshot
(
snapshot
);
// ensure that .thisN vals are up to date
...
...
@@ -730,7 +680,6 @@ function Training_IntroRoutineBegin(snapshot) {
}
}
function
Training_IntroRoutineEachFrame
()
{
return
async
function
()
{
//------Loop for each frame of Routine 'Training_Intro'-------
...
...
@@ -798,7 +747,6 @@ function Training_IntroRoutineEachFrame() {
};
}
function
Training_IntroRoutineEnd
()
{
return
async
function
()
{
//------Ending Routine 'Training_Intro'-------
...
...
@@ -815,9 +763,6 @@ function Training_IntroRoutineEnd() {
};
}
var
training_loop
;
var
currentLoop
;
function
training_loopLoopBegin
(
training_loopLoopScheduler
,
snapshot
)
{
return
async
function
()
{
TrialHandler
.
fromSnapshot
(
snapshot
);
// update internal variables (.thisN etc) of the loop
...
...
@@ -854,15 +799,12 @@ function training_loopLoopBegin(training_loopLoopScheduler, snapshot) {
}
}
async
function
training_loopLoopEnd
()
{
psychoJS
.
experiment
.
removeLoop
(
training_loop
);
return
Scheduler
.
Event
.
NEXT
;
}
var
loop_over_blocks
;
function
loop_over_blocksLoopBegin
(
loop_over_blocksLoopScheduler
,
snapshot
)
{
return
async
function
()
{
TrialHandler
.
fromSnapshot
(
snapshot
);
// update internal variables (.thisN etc) of the loop
...
...
@@ -900,8 +842,6 @@ function loop_over_blocksLoopBegin(loop_over_blocksLoopScheduler, snapshot) {
}
}
var
loop_over_trials
;
function
loop_over_trialsLoopBegin
(
loop_over_trialsLoopScheduler
,
snapshot
)
{
return
async
function
()
{
TrialHandler
.
fromSnapshot
(
snapshot
);
// update internal variables (.thisN etc) of the loop
...
...
@@ -938,23 +878,18 @@ function loop_over_trialsLoopBegin(loop_over_trialsLoopScheduler, snapshot) {
}
}
async
function
loop_over_trialsLoopEnd
()
{
psychoJS
.
experiment
.
removeLoop
(
loop_over_trials
);
return
Scheduler
.
Event
.
NEXT
;
}
async
function
loop_over_blocksLoopEnd
()
{
psychoJS
.
experiment
.
removeLoop
(
loop_over_blocks
);
return
Scheduler
.
Event
.
NEXT
;
}
var
_key_resp_2_allKeys
;
var
masked_trainingComponents
;
function
masked_trainingRoutineBegin
(
snapshot
)
{
return
async
function
()
{
TrialHandler
.
fromSnapshot
(
snapshot
);
// ensure that .thisN vals are up to date
...
...
@@ -965,6 +900,40 @@ function masked_trainingRoutineBegin(snapshot) {
frameN
=
-
1
;
continueRoutine
=
true
;
// until we're told otherwise
// update component parameters for each repeat
import
*
as
random
from
'random'
;
import
*
as
os
from
'os'
;
var
_pj
;
var
flag
,
middle_range
,
selected_class
,
the_range
,
training_image_mask
,
trial_number
;
function
_pj_snippets
(
container
)
{
function
in_es6
(
left
,
right
)
{
if
(((
right
instanceof
Array
)
||
((
typeof
right
)
===
"string"
)))
{
return
(
right
.
indexOf
(
left
)
>
(
-
1
));
}
else
{
if
(((
right
instanceof
Map
)
||
(
right
instanceof
Set
)
||
(
right
instanceof
WeakMap
)
||
(
right
instanceof
WeakSet
)))
{
return
right
.
has
(
left
);
}
else
{
return
(
left
in
right
);
}
}
}
container
[
"in_es6"
]
=
in_es6
;
return
container
;
}
_pj
=
{};
_pj_snippets
(
_pj
);
flag
=
false
;
while
((
flag
===
false
))
{
selected_class
=
random
.
choice
(
classes_labels
);
if
((
!
_pj
.
in_es6
(
selected_class
,
training_list
)))
{
training_list
.
push
(
selected_class
);
flag
=
true
;
}
}
the_range
=
range_dict
[
selected_class
];
middle_range
=
the_range
[
Number
.
parseInt
((
the_range
.
length
/
2
))];
trial_number
=
random
.
randint
(
1
,
100
);
training_image_mask
=
((((((
masked_images_dir
+
selected_class
)
+
"/"
)
+
middle_range
.
toString
())
+
"/"
)
+
trial_number
.
toString
())
+
".jpg"
);
image
.
setImage
(
training_image_mask
);
key_resp_2
.
keys
=
undefined
;
key_resp_2
.
rt
=
undefined
;
...
...
@@ -983,7 +952,6 @@ function masked_trainingRoutineBegin(snapshot) {
}
}
function
masked_trainingRoutineEachFrame
()
{
return
async
function
()
{
//------Loop for each frame of Routine 'masked_training'-------
...
...
@@ -1061,7 +1029,6 @@ function masked_trainingRoutineEachFrame() {
};
}
function
masked_trainingRoutineEnd
()
{
return
async
function
()
{
//------Ending Routine 'masked_training'-------
...
...
@@ -1078,8 +1045,6 @@ function masked_trainingRoutineEnd() {
};
}
var
Answer_trainingComponents
;
function
Answer_trainingRoutineBegin
(
snapshot
)
{
return
async
function
()
{
TrialHandler
.
fromSnapshot
(
snapshot
);
// ensure that .thisN vals are up to date
...
...
@@ -1115,8 +1080,6 @@ function Answer_trainingRoutineBegin(snapshot) {
}
}
var
class_choose
;
function
Answer_trainingRoutineEachFrame
()
{
return
async
function
()
{
//------Loop for each frame of Routine 'Answer_training'-------
...
...
@@ -1667,7 +1630,6 @@ function Answer_trainingRoutineEachFrame() {
};
}
function
Answer_trainingRoutineEnd
()
{
return
async
function
()
{
//------Ending Routine 'Answer_training'-------
...
...
@@ -1683,9 +1645,6 @@ function Answer_trainingRoutineEnd() {
};
}
var
_key_resp_8_allKeys
;
var
unmasked_trainingComponents
;
function
unmasked_trainingRoutineBegin
(
snapshot
)
{
return
async
function
()
{
TrialHandler
.
fromSnapshot
(
snapshot
);
// ensure that .thisN vals are up to date
...
...
@@ -1696,6 +1655,9 @@ function unmasked_trainingRoutineBegin(snapshot) {
frameN
=
-
1
;
continueRoutine
=
true
;
// until we're told otherwise
// update component parameters for each repeat
unmask_image
=
((
unmasked_images_dir
+
selected_class
)
+
".JPEG"
);
the_text
=
((
"You had to choose "
+
selected_class
.
toString
())
+
" ."
);
image_4
.
setImage
(
unmask_image
);
key_resp_8
.
keys
=
undefined
;
key_resp_8
.
rt
=
undefined
;
...
...
@@ -1716,7 +1678,6 @@ function unmasked_trainingRoutineBegin(snapshot) {
}
}
function
unmasked_trainingRoutineEachFrame
()
{
return
async
function
()
{
//------Loop for each frame of Routine 'unmasked_training'-------
...
...
@@ -1804,7 +1765,6 @@ function unmasked_trainingRoutineEachFrame() {
};
}
function
unmasked_trainingRoutineEnd
()
{
return
async
function
()
{
//------Ending Routine 'unmasked_training'-------
...
...
@@ -1821,9 +1781,6 @@ function unmasked_trainingRoutineEnd() {
};
}
var
_key_resp_4_allKeys
;
var
Testing_IntroComponents
;
function
Testing_IntroRoutineBegin
(
snapshot
)
{
return
async
function
()
{
TrialHandler
.
fromSnapshot
(
snapshot
);
// ensure that .thisN vals are up to date
...
...
@@ -1850,7 +1807,6 @@ function Testing_IntroRoutineBegin(snapshot) {
}
}
function
Testing_IntroRoutineEachFrame
()
{
return
async
function
()
{
//------Loop for each frame of Routine 'Testing_Intro'-------
...
...
@@ -1918,7 +1874,6 @@ function Testing_IntroRoutineEachFrame() {
};
}
function
Testing_IntroRoutineEnd
()
{
return
async
function
()
{
//------Ending Routine 'Testing_Intro'-------
...
...
@@ -1935,8 +1890,6 @@ function Testing_IntroRoutineEnd() {
};
}
var
catch_trialComponents
;
function
catch_trialRoutineBegin
(
snapshot
)
{
return
async
function
()
{
TrialHandler
.
fromSnapshot
(
snapshot
);
// ensure that .thisN vals are up to date
...
...
@@ -1947,6 +1900,11 @@ function catch_trialRoutineBegin(snapshot) {
frameN
=
-
1
;
continueRoutine
=
true
;
// until we're told otherwise
// update component parameters for each repeat
catch_trial_list
=
[];
catch_trial_1
=
random
.
randint
(
3
,
7
);
catch_trial_list
.
push
(
catch_trial_1
);
trial_loop_counter
=
0
;
// keep track of which components have finished
catch_trialComponents
=
[];
...
...
@@ -1958,7 +1916,6 @@ function catch_trialRoutineBegin(snapshot) {
}
}
function
catch_trialRoutineEachFrame
()
{
return
async
function
()
{
//------Loop for each frame of Routine 'catch_trial'-------
...
...
@@ -1992,7 +1949,6 @@ function catch_trialRoutineEachFrame() {
};
}
function
catch_trialRoutineEnd
()
{
return
async
function
()
{
//------Ending Routine 'catch_trial'-------
...
...
@@ -2008,9 +1964,6 @@ function catch_trialRoutineEnd() {
};
}
var
_key_resp_9_allKeys
;
var
Im_readyComponents
;
function
Im_readyRoutineBegin
(
snapshot
)
{
return
async
function
()
{
TrialHandler
.
fromSnapshot
(
snapshot
);
// ensure that .thisN vals are up to date
...
...
@@ -2037,7 +1990,6 @@ function Im_readyRoutineBegin(snapshot) {
}
}
function
Im_readyRoutineEachFrame
()
{
return
async
function
()
{
//------Loop for each frame of Routine 'Im_ready'-------
...
...
@@ -2105,7 +2057,6 @@ function Im_readyRoutineEachFrame() {
};
}
function
Im_readyRoutineEnd
()
{
return
async
function
()
{
//------Ending Routine 'Im_ready'-------
...
...
@@ -2122,9 +2073,6 @@ function Im_readyRoutineEnd() {
};
}
var
_key_resp_5_allKeys
;
var
test_maskComponents
;
function
test_maskRoutineBegin
(
snapshot
)
{
return
async
function
()
{
TrialHandler
.
fromSnapshot
(
snapshot
);
// ensure that .thisN vals are up to date
...
...
@@ -2135,6 +2083,78 @@ function test_maskRoutineBegin(snapshot) {
frameN
=
-
1
;
continueRoutine
=
true
;
// until we're told otherwise
// update component parameters for each repeat
import
*
as
np
from
'numpy'
;
var
_pj
;
var
answer
,
flag
,
flag_catch_trial
,
middle_range
,
now_index
,
num_of_catch_trial
,
num_of_loops_for_block
,
precision
,
range_selected_class
,
selected_class
,
test_image_mask
,
the_range
,
threshold
,
trial_number
;
function
_pj_snippets
(
container
)
{
function
in_es6
(
left
,
right
)
{
if
(((
right
instanceof
Array
)
||
((
typeof
right
)
===
"string"
)))
{
return
(
right
.
indexOf
(
left
)
>
(
-
1
));
}
else
{
if
(((
right
instanceof
Map
)
||
(
right
instanceof
Set
)
||
(
right
instanceof
WeakMap
)
||
(
right
instanceof
WeakSet
)))
{
return
right
.
has
(
left
);
}
else
{
return
(
left
in
right
);
}
}
}
container
[
"in_es6"
]
=
in_es6
;
return
container
;
}
_pj
=
{};
_pj_snippets
(
_pj
);
answer
=
""
;
threshold
=
3
;
num_of_catch_trial
=
1
;
num_of_loops_for_block
=
10
;
precision
=
null
;
flag
=
false
;
while
((
flag
===
false
))
{
selected_class
=
random
.
choice
(
classes_labels
);
if
((
!
_pj
.
in_es6
(
selected_class
,
training_list
)))
{
flag
=
true
;
}
}
trial_loop_counter
+=
1
;
flag_catch_trial
=
false
;
if
(
_pj
.
in_es6
(
trial_loop_counter
,
catch_trial_list
))
{
flag_catch_trial
=
true
;
}
the_range
=
range_dict
[
selected_class
];
if
((
flag_catch_trial
===
true
))
{
range_selected_class
=
the_range
.
slice
((
-
1
))[
0
];
}
else
{
if
((
images_dict
[
selected_class
][
1
]
===
0
))
{
middle_range
=
the_range
[
Number
.
parseInt
((
the_range
.
length
/
2
))];
images_dict
[
selected_class
][
1
]
=
middle_range
;
}
else
{
if
((
images_dict
[
selected_class
][
0
].
length
===
threshold
))
{
precision
=
np
.
mean
(
images_dict
[
selected_class
][
0
]);
now_index
=
util
.
index
(
the_range
,
images_dict
[
selected_class
][
1
]);
if
((
precision
>
0.65
))
{
now_index
+=
1
;
}
else
{
if
((
precision
<
0.35
))
{
now_index
-=
1
;
}
else
{
now_index
+=
0
;
}
}
if
((
now_index
<
0
))
{
now_index
=
0
;
}
else
{
if
((
now_index
>=
the_range
.
length
))
{
now_index
=
(
the_range
.
length
-
1
);
}
}
images_dict
[
selected_class
][
1
]
=
the_range
[
now_index
];
}
}
range_selected_class
=
images_dict
[
selected_class
][
1
];
}
trial_number
=
random
.
randint
(
1
,
100
);
test_image_mask
=
((((((
masked_images_dir
+
selected_class
)
+
"/"
)
+
range_selected_class
.
toString
())
+
"/"
)
+
trial_number
.
toString
())
+
".jpg"
);
image_2
.
setImage
(
test_image_mask
);
key_resp_5
.
keys
=
undefined
;
key_resp_5
.
rt
=
undefined
;
...
...
@@ -2152,7 +2172,6 @@ function test_maskRoutineBegin(snapshot) {
}
}
function
test_maskRoutineEachFrame
()
{
return
async
function
()
{
//------Loop for each frame of Routine 'test_mask'-------
...
...
@@ -2220,7 +2239,6 @@ function test_maskRoutineEachFrame() {
};
}
function
test_maskRoutineEnd
()
{
return
async
function
()
{
//------Ending Routine 'test_mask'-------
...
...
@@ -2237,8 +2255,6 @@ function test_maskRoutineEnd() {
};
}
var
answer_sheetComponents
;
function
answer_sheetRoutineBegin
(
snapshot
)
{
return
async
function
()
{
TrialHandler
.
fromSnapshot
(
snapshot
);
// ensure that .thisN vals are up to date
...
...
@@ -2274,8 +2290,6 @@ function answer_sheetRoutineBegin(snapshot) {
}
}
var
answer
;
function
answer_sheetRoutineEachFrame
()
{
return
async
function
()
{
//------Loop for each frame of Routine 'answer_sheet'-------
...
...
@@ -2826,7 +2840,6 @@ function answer_sheetRoutineEachFrame() {
};
}
function
answer_sheetRoutineEnd
()
{
return
async
function
()
{
//------Ending Routine 'answer_sheet'-------
...
...
@@ -2835,6 +2848,21 @@ function answer_sheetRoutineEnd() {
thisComponent
.
setAutoDraw
(
false
);
}
});
if
((
answer
===
selected_class
))
{
acc
=
1
;
}
else
{
acc
=
0
;
}
images_dict
[
selected_class
][
0
].
push
(
acc
);
if
((
images_dict
[
selected_class
][
0
].
length
===
(
threshold
+
1
)))
{
images_dict
[
selected_class
][
0
].
pop
(
0
);
}
psychoJS
.
experiment
.
addData
(
"answer"
,
answer
);
psychoJS
.
experiment
.
addData
(
"class"
,
selected_class
);
psychoJS
.
experiment
.
addData
(
"range"
,
range_selected_class
);
psychoJS
.
experiment
.
addData
(
"trail_number"
,
trial_number
);
psychoJS
.
experiment
.
addData
(
"catch_trial"
,
flag_catch_trial
);
// the Routine "answer_sheet" was not non-slip safe, so reset the non-slip timer
routineTimer
.
reset
();
...
...
@@ -2842,9 +2870,6 @@ function answer_sheetRoutineEnd() {
};
}
var
_key_resp_7_allKeys
;
var
Rest_after_blockComponents
;
function
Rest_after_blockRoutineBegin
(
snapshot
)
{
return
async
function
()
{
TrialHandler
.
fromSnapshot
(
snapshot
);
// ensure that .thisN vals are up to date
...
...
@@ -2871,7 +2896,6 @@ function Rest_after_blockRoutineBegin(snapshot) {
}
}
function
Rest_after_blockRoutineEachFrame
()
{
return
async
function
()
{
//------Loop for each frame of Routine 'Rest_after_block'-------
...
...
@@ -2939,7 +2963,6 @@ function Rest_after_blockRoutineEachFrame() {
};
}
function
Rest_after_blockRoutineEnd
()
{
return
async
function
()
{
//------Ending Routine 'Rest_after_block'-------
...
...
@@ -2956,9 +2979,6 @@ function Rest_after_blockRoutineEnd() {
};
}
var
_key_resp_3_allKeys
;
var
Final_messageComponents
;
function
Final_messageRoutineBegin
(
snapshot
)
{
return
async
function
()
{
TrialHandler
.
fromSnapshot
(
snapshot
);
// ensure that .thisN vals are up to date
...
...
@@ -2985,7 +3005,6 @@ function Final_messageRoutineBegin(snapshot) {
}
}
function
Final_messageRoutineEachFrame
()
{
return
async
function
()
{
//------Loop for each frame of Routine 'Final_message'-------
...
...
@@ -3053,7 +3072,6 @@ function Final_messageRoutineEachFrame() {
};
}
function
Final_messageRoutineEnd
()
{
return
async
function
()
{
//------Ending Routine 'Final_message'-------
...
...
@@ -3070,7 +3088,6 @@ function Final_messageRoutineEnd() {
};
}
function
endLoopIteration
(
scheduler
,
snapshot
)
{
// ------Prepare for next entry------
return
async
function
()
{
...
...
@@ -3093,7 +3110,6 @@ function endLoopIteration(scheduler, snapshot) {
};
}
function
importConditions
(
currentLoop
)
{
return
async
function
()
{
psychoJS
.
importAttributes
(
currentLoop
.
getCurrentTrial
());
...
...
@@ -3101,7 +3117,6 @@ function importConditions(currentLoop) {
};
}
async
function
quitPsychoJS
(
message
,
isCompleted
)
{
// Check for and save orphaned data
if
(
psychoJS
.
experiment
.
isEntryEmpty
())
{
...
...
@@ -3121,6 +3136,8 @@ async function quitPsychoJS(message, isCompleted) {
psychoJS
.
window
.
close
();
psychoJS
.
quit
({
message
:
message
,
isCompleted
:
isCompleted
});
...
...
Object_Segments_CNN.js
View file @
4e99d0ab
...
...
@@ -16,6 +16,33 @@ let expName = 'Object_Segments_CNN'; // from the Builder filename that created
let
expInfo
=
{
'session'
:
'001'
,
'participant'
:
'001'
};
// Start code blocks for 'Before Experiment'
training_list
=
[];
classes_labels
=
[
"car"
,
"elephant"
,
"fish"
,
"hammer"
,
"hand_blower"
,
"hat"
,
"iron"
,
"ladybug"
,
"pineapple"
,
"pot"
,
"sewing_machine"
,
"violin"
];
masked_images_dir
=
"images_dir/masked_datasets/"
;
unmasked_images_dir
=
"images_dir/unmasked_datasets/"
;
range_dict
=
{};
for
(
var
item
,
_pj_c
=
0
,
_pj_a
=
classes_labels
,
_pj_b
=
_pj_a
.
length
;
(
_pj_c
<
_pj_b
);
_pj_c
+=
1
)
{
item
=
_pj_a
[
_pj_c
];
range_list_str
=
os
.
listdir
((
masked_images_dir
+
item
));
range_list_int
=
function
()
{
var
_pj_d
=
[],
_pj_e
=
range_list_str
;
for
(
var
_pj_f
=
0
,
_pj_g
=
_pj_e
.
length
;
(
_pj_f
<
_pj_g
);
_pj_f
+=
1
)
{
var
i
=
_pj_e
[
_pj_f
];
_pj_d
.
push
(
Number
.
parseInt
(
i
));
}
return
_pj_d
;
}
.
call
(
this
);
range_list_int
.
sort
();
range_dict
.
update
({[
item
]:
range_list_int
});
}
images_dict
=
{};
for
(
var
element
,
_pj_c
=
0
,
_pj_a
=
classes_labels
,
_pj_b
=
_pj_a
.
length
;
(
_pj_c
<
_pj_b
);
_pj_c
+=
1
)
{
element
=
_pj_a
[
_pj_c
];
images_dict
.
update
({[
element
]:
[[],
0
]});
}
// init psychoJS:
const
psychoJS
=
new
PsychoJS
({
debug
:
true
...
...
@@ -75,8 +102,6 @@ psychoJS.start({
psychoJS
.
experimentLogger
.
setLevel
(
core
.
Logger
.
ServerLevel
.
EXP
);
var
frameDur
;
async
function
updateInfo
()
{
expInfo
[
'date'
]
=
util
.
MonotonicClock
.
getDateStr
();
// add a simple timestamp
expInfo
[
'expName'
]
=
expName
;
...
...
@@ -96,70 +121,6 @@ async function updateInfo() {
return
Scheduler
.
Event
.
NEXT
;
}
var
AckClock
;
var
Acknowledgement
;
var
key_resp1
;
var
Training_IntroClock
;
var
text
;
var
key_resp
;
var
masked_trainingClock
;
var
image
;
var
text_2
;
var
key_resp_2
;
var
Answer_trainingClock
;
var
text_7
;
var
fish
;
var
hammer
;
var
elephant
;
var
Pineapple
;
var
pot
;
var
Hat
;
var
iron
;
var
hand_blower
;
var
Violin
;
var
sewing_machine
;
var
Car
;
var
Ladybug
;
var
idk
;
var
unmasked_trainingClock
;
var
image_4
;
var
key_resp_8
;
var
text_8
;
var
text_10
;
var
Testing_IntroClock
;
var
text_3
;
var
key_resp_4
;
var
catch_trialClock
;