-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutils.jl
39 lines (37 loc) · 1.11 KB
/
utils.jl
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
function parse_commandline()
s = ArgParseSettings()
@add_arg_table s begin
"--startidx"
help = "Start index"
arg_type = Int
default = 1
"--endidx"
help = "End index"
arg_type = Int
default = 1000
"--n_offsets"
help = "num of offsets"
arg_type = Int
default = 51
"--offset_start"
help = "start of offset"
arg_type = Float32
default = -500f0
"--offset_end"
help = "end of offset"
arg_type = Float32
default = 500f0
"--keep_offset_num"
help = "keep how many offset during training"
arg_type = Int
default = 51
end
return parse_args(s)
end
function ContJitter(l::Number, num::Int)
#l = length, num = number of samples
interval_width = l/num
interval_center = range(interval_width/2, stop = l-interval_width/2, length=num)
randomshift = interval_width .* rand(Float32, num) .- interval_width/2
return interval_center .+ randomshift
end