From 6f92cdb090b2e880bddb8f76251b5df263e4db14 Mon Sep 17 00:00:00 2001 From: belledon Date: Wed, 24 May 2023 11:55:35 -0400 Subject: [PATCH 01/10] path cost checkpoint --- deps/Gen_Compose | 2 +- requirements.txt | 2 + .../analysis/ccn_2023_change_detection.Rmd | 64 +++++- scripts/analysis/scene_path_analysis.jl | 76 ++++++ scripts/analysis/scene_path_viz.py | 55 +++++ scripts/stimuli/generate_condlist.py | 13 +- .../stimuli/match_path_cost/generate_rooms.jl | 214 +++++++++++++++++ scripts/stimuli/path_cost/generate_rooms.jl | 217 ++++++++++++++++++ scripts/stimuli/render_rooms.jl | 27 +-- src/blender/render.py | 2 - src/dgp/dgp.jl | 3 + src/dgp/path_based/path_based.jl | 9 +- src/dgp/path_based/path_cost.jl | 105 +++++++++ test/dgp/dgp.jl | 57 ++++- 14 files changed, 815 insertions(+), 31 deletions(-) create mode 100644 scripts/analysis/scene_path_analysis.jl create mode 100644 scripts/analysis/scene_path_viz.py create mode 100644 scripts/stimuli/match_path_cost/generate_rooms.jl create mode 100644 scripts/stimuli/path_cost/generate_rooms.jl create mode 100644 src/dgp/path_based/path_cost.jl diff --git a/deps/Gen_Compose b/deps/Gen_Compose index 6d3648b..c309980 160000 --- a/deps/Gen_Compose +++ b/deps/Gen_Compose @@ -1 +1 @@ -Subproject commit 6d3648b6d3e2702b1dc3caeac2365cbbb835e0b2 +Subproject commit c30998028cc597be14538ef4f565ae76eaeb504f diff --git a/requirements.txt b/requirements.txt index 3f92d40..9864526 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,8 +5,10 @@ sqlalchemy numba opencv-python-headless ninja +plotly torch torchvision +drjit mitsuba fvcore iopath diff --git a/scripts/analysis/ccn_2023_change_detection.Rmd b/scripts/analysis/ccn_2023_change_detection.Rmd index 175f045..37bd39e 100644 --- a/scripts/analysis/ccn_2023_change_detection.Rmd +++ b/scripts/analysis/ccn_2023_change_detection.Rmd @@ -151,7 +151,7 @@ delta_hr_by_scene %>% t0 = mean(delta_hr_by_scene$abs_f_diff) -f1 <- delta_hr_by_scene %>% +delta_hr_by_scene %>% ggplot(aes(abs_f_diff)) + geom_vline(xintercept = `t0`, size = 1.25, @@ -223,7 +223,7 @@ inv_t0 = 0.063 sum((inv_t0 < reps$t)) / length(reps$t) rdf = data.frame(t = reps$t) -p <- rdf %>% +rdf %>% ggplot(aes(x = t)) + geom_histogram(fill = "grey") + geom_vline(xintercept = reps$t0, @@ -299,6 +299,66 @@ t.test(upright_dhr_analysis$up_diff, upright_dhr_analysis$abs_f_diff) ``` + +### Path length analysis + + +```{r} + + +path_metrics <- read.csv("~/project/spaths/datasets/ccn_2023_exp_path_metrics.csv") %>% + rename(scene = id) + +path_comps <- path_metrics %>% + group_by(scene, door) %>% + select(scene, door, starts_with("path")) %>% + summarise(across(everything(), + list(mean = mean, max = max, min = min, diff = diff))) %>% + left_join(passed_hits) + +path_comps %>% + ggplot(aes(x = path_cost_diff, y = f, label = scene, color = factor(door))) + + geom_point() + + geom_text(hjust=0, vjust=0) + +path_comps %>% + ggplot(aes(x = path_dist_mean, y = f, label = scene, color = factor(door), group = scene)) + + geom_point() + + geom_text(hjust=0, vjust=0) + + geom_line() + +path_comps %>% + with(lm(f ~ path_dist_mean)) %>% + summary() + +path_comps %>% + ggplot(aes(x = path_dist_max, y = f, label = scene, color = factor(door))) + + geom_point() + + geom_text(hjust=0, vjust=0) + +path_comps %>% + with(lm(f ~ path_dist_max)) %>% + summary() + +pairwise_differences <- path_comps %>% + group_by(scene) %>% + summarise(across(c(path_dist_mean), + list(mean = mean, diff = diff))) %>% +left_join(delta_hr_by_scene) + +pairwise_differences %>% + ggplot(aes(x = path_dist_mean_diff, y = f_diff, label = scene)) + + geom_point() + + geom_text(hjust=0, vjust=0) + +pairwise_differences %>% + ggplot(aes(x = path_dist_mean_mean, y = f_diff, label = scene)) + + geom_point() + + geom_text(hjust=0, vjust=0) + +``` + + ### Multi-granular Attention ```{r} diff --git a/scripts/analysis/scene_path_analysis.jl b/scripts/analysis/scene_path_analysis.jl new file mode 100644 index 0000000..6d07fa5 --- /dev/null +++ b/scripts/analysis/scene_path_analysis.jl @@ -0,0 +1,76 @@ +using Gen +using CSV +using JSON +using PyCall +using FileIO +using ArgParse +using DataFrames +using FunctionalScenes +using Random + +np = pyimport("numpy") + +name = "pathcost_3.0" +function main() + + src = "/spaths/datasets/$(name)" + df = DataFrame(CSV.File("$(src)/scenes.csv")) + samples = 300 + + n = nrow(df) * 2 + + out = "/spaths/datasets/$(name)_path" + isdir(out) || mkdir(out) + + # for c = LinRange(0.5, 4.5, 8), k = [5,7,9] + # for c = LinRange(0.5, 4.5, 4), fc = LinRange(0.01, 0.5, 4), k = [7] + for c = [1.64], fc = [0.01], k = [7] + # for c = [1.64], k = [7] + params = NoisyPath( + obstacle_cost = c, + floor_cost = fc, + kernel_width = k + ) + paths = Array{Float64}(undef, (30, 2, 2, 32, 32)) + results = DataFrame(scene = Int64[], + door = Int64[], + is_shifted = Bool[], + path_cost = Float64[], + path_dist = Float64[], + obstacle_cost = Float64[], + floor_cost = Float64[], + kernel_width = Int64[]) + metric_out = "$(out)/$(c)_$(fc)_$(k)_path_metrics.csv" + isfile(metric_out) && continue + for row in eachrow(df) + @show (row.scene) + base_p = "/spaths/datasets/$(name)/scenes/$(row.scene)_$(row.door).json" + local base_s + open(base_p, "r") do f + base_s = JSON.parse(f) + end + base = from_json(GridRoom, base_s) + to_shift = furniture(base)[row.furniture] + + base_cost, base_path = noisy_path(base, params; + samples=samples) + base_dist = FunctionalScenes.distance_to_path(to_shift, base_path) + paths[row.scene, row.door, 1, :, :] = base_path + push!(results, (row.scene, row.door, false, base_cost, base_dist, c, fc, k)) + + shifted = shift_furniture(base, + to_shift, + Symbol(row.move)) + shift_cost, shift_path = noisy_path(shifted, params; + samples=samples) + paths[row.scene, row.door, 2, :, :] = shift_path + shift_dist = FunctionalScenes.distance_to_path(to_shift, shift_path) + push!(results, (row.scene, row.door, true, shift_cost, shift_dist, c, fc, k)) + end + + np.save("$(out)/$(c)_$(fc)_$(k)_noisy_paths.npy", paths) + CSV.write(metric_out, results) + end +end + +main(); diff --git a/scripts/analysis/scene_path_viz.py b/scripts/analysis/scene_path_viz.py new file mode 100644 index 0000000..24d207c --- /dev/null +++ b/scripts/analysis/scene_path_viz.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python3 + +import numpy as np +import pandas as pd +import plotly.graph_objects as go +from plotly.subplots import make_subplots + +def downsample(a, n:int = 2): + if n ==1 : + return a + b = a.shape[0]//n + a_downsampled = a.reshape(-1, n, b, n).sum((-1, -3)) / (n*n) + return a_downsampled + + +EXPNAME = 'pathcost_3.0' +scale = 1 + +def main(): + + df_path = f"/spaths/datasets/{EXPNAME}/scenes.csv" + df = pd.read_csv(df_path) + # df = df.loc[map(lambda x: x in scenes, df['id'])] + + row_count = 1 + fig = make_subplots(rows=60, cols=2, + shared_xaxes=True, + shared_yaxes=True) + + path_file = '1.64_0.01_7' + paths = np.load(f'/spaths/datasets/{EXPNAME}_path/{path_file}_noisy_paths.npy') + + for scene in range(30): + for door in range(2): + fig.update_yaxes(title_text=f"{scene+1}, {door+1}", + row=row_count, col=1) + pmat_a = downsample(paths[scene, door, 0], n = scale) + pmat_hm = go.Heatmap(z = pmat_a.T, coloraxis="coloraxis3") + fig.add_trace(pmat_hm, row = row_count, col = 1) + + pmat_b = downsample(paths[scene, door, 1], n = scale) + pmat_hm = go.Heatmap(z = pmat_b.T, coloraxis="coloraxis3") + fig.add_trace(pmat_hm, row = row_count, col = 2) + row_count += 1 + + fig.update_layout( + height = 300 * 30 * 2, + width = 800, + coloraxis3=dict(colorscale='greens'), + showlegend=False + ) + fig.write_html(f'/spaths/datasets/{EXPNAME}_path/{path_file}_noisy_paths.html') + +if __name__ == '__main__': + main() diff --git a/scripts/stimuli/generate_condlist.py b/scripts/stimuli/generate_condlist.py index 8dae057..0b5bcd2 100755 --- a/scripts/stimuli/generate_condlist.py +++ b/scripts/stimuli/generate_condlist.py @@ -14,7 +14,7 @@ def main(): ) parser.add_argument('--dataset', type = str, help = "Which scene dataset to use", - default = 'vss_pilot') + default = 'pathcost') parser.add_argument('--render', type = str, help = "Which render mode", choices = ['cycles'], default = 'cycles') @@ -30,14 +30,11 @@ def main(): # groupby move for (_, r) in df.iterrows(): # first create each `a->a` trial - base = '{0:d}_{1:d}.png'.format(r.id, r.door) - - aa_movies.append([base, base, r.flip]) + base = f'{r.scene}_{r.door}.png' + aa_movies.append([base, base, r.flipx]) # then proceed to make `a -> b` trials - move = '{0:d}_{1:d}_{2:d}_{3!s}.png'.format(r.id, r.door, - r.furniture, - r.move) - ab_movies.append([base, move, r.flip]) + move = f'{r.scene}_{r.door}_shifted.png' + ab_movies.append([base, move, r.flipx]) # repeate aa trials to have a 50/50 split naa = len(aa_movies) diff --git a/scripts/stimuli/match_path_cost/generate_rooms.jl b/scripts/stimuli/match_path_cost/generate_rooms.jl new file mode 100644 index 0000000..86e55d4 --- /dev/null +++ b/scripts/stimuli/match_path_cost/generate_rooms.jl @@ -0,0 +1,214 @@ +using CSV +using Gen +using JSON +using DataFrames +using Statistics +using FunctionalScenes +using LinearAlgebra: norm +using FunctionalCollections + +# using Profile +# using StatProfilerHTML + +function valid_pair(pair::Tuple, m::Move; + pc_diff_thresh::Float64 = 1.0, + pc_upper_bound::Float64 = 20.00 + )::Bool + + (d1, d2, f, pc1, pc2) = pair + @show abs(pc1 - pc2) + @show max(pc1, pc2) + # f > 0 + f > 0 && + abs(pc1 - pc2) < pc_diff_thresh && + max(pc1, pc2) < pc_upper_bound +end + +function gen_obstacle_weights(template::GridRoom; + pct_open::Float64 = 0.3, + side_buffer::Int64 = 1) + dims = steps(template) + # prevent furniture generated in either: + # -1 out of sight + # -2 blocking entrance exit + # -3 hard to detect spaces next to walls + weights = Matrix{Bool}(zeros(dims)) + # ensures that there is no furniture near the observer + start_x = Int64(ceil(last(dims) * pct_open)) + stop_x = last(dims) - 2 # nor blocking the exit + # buffer along sides + start_y = side_buffer + 1 + stop_y = first(dims) - side_buffer + weights[start_y:stop_y, start_x:stop_x] .= 1.0 + # vectorize for `furniture_gm` + PersistentVector(vec(weights)) +end + +function average_tile_position(r::GridRoom, tiles) + ny, _ = steps(r) + pos = zeros(2) + for t in tiles + pos[1] += ceil(t / ny) / ny - 0.5 + pos[2] += (t % ny) / ny - 0.5 + end + pos .*= 1/length(tiles) + return pos +end + +function select_obstacle(r::GridRoom, m::Move; + xbuffer::Float64 = 0.0, + ybuffer::Float64 = 0.3) + fs = furniture(r) + nf = length(fs) + raw_weights = zeros(nf) + @inbounds for i = 1:nf + f = fs[i] + valid_move(r, f, m) || continue + avg_pos = average_tile_position(r, f) + raw_weights[i] = 1.0 * ( + (avg_pos[1] > xbuffer) && + (abs(avg_pos[2]) < ybuffer)) + end + srw = sum(raw_weights) + srw == 0 && return 0 + ws = raw_weights ./ srw + categorical(ws) +end + +function create_pair(door_conditions::Vector{GridRoom}, + move::Move, + obstacle_weights::PersistentVector, + path_params::Dict; + max_f::Int64 = 8, + max_size::Int64 = 5) + # generate furniture once and then apply to + # each door condition + template = door_conditions[1] + with_furn = + furniture_gm(template, obstacle_weights, max_f, max_size) + + d1 = expand(with_furn, 2) # door1 already added + d2 = expand(add(with_furn, door_conditions[2]), 2) + + # pick a random obstacle to move + furn_selected = select_obstacle(d1, move) + + # measure the differences in path complexity between the two doors + pc_1, _ = noisy_path(d1; path_params...) + pc_2, _ = noisy_path(d2; path_params...) + + (d1, d2, furn_selected, pc_1, pc_2) +end + +function update_df!(df::DataFrame, id::Int64, move::Move, + flipx::Bool, pair::Tuple) + d1, d2, furn_selected, pc_1, pc_2 = pair + push!(df, (id, flipx, 1, furn_selected, move, pc_1)) + push!(df, (id, flipx, 2, furn_selected, move, pc_2)) + return nothing +end + +function save_pair(out::String, id::Int64, pair::Tuple) + d1, d2, _... = pair + open("$(out)/$(id)_1.json", "w") do f + _d = d1 |> json + write(f, _d) + end + open("$(out)/$(id)_2.json", "w") do f + _d = d2 |> json + write(f, _d) + end + return nothing +end + +function main() + # dataset name + name = "matched_pathcost_1.0" + + dataset_out = "/spaths/datasets/$(name)" + isdir(dataset_out) || mkdir(dataset_out) + scenes_out = "$(dataset_out)/scenes" + isdir(scenes_out) || mkdir(scenes_out) + + # Parameters + rsteps = (16, 16) + rbounds = (16., 16.) + entrance = [8, 9] + door_rows = [5, 12] + inds = LinearIndices(rsteps) + doors = inds[door_rows, rsteps[2]] + + # will only consider these moves + moves = [down_move, up_move] + + # Path planning + # leaving gamma(a,b) to default + path_params = Dict( + :samples => 100, + :cost => 1.64, + :width => 7, + ) + + # Acceptance criteria, see `valid_pair` + criteria = Dict( + :pc_diff_thresh => 4.0, + :pc_upper_bound => 30.0 + ) + + # number of trials + n = 20 + + # number of trials per move condition + max_per_move = Int64(ceil(n / length(moves))) + + # empty rooms with doors + t1 = GridRoom(rsteps, rbounds, entrance, [doors[1]]) + t2 = GridRoom(rsteps, rbounds, entrance, [doors[2]]) + templates = [t1, t2] + + obstacle_weights = gen_obstacle_weights(templates[1]) + + # will store summary of generated rooms here + df = DataFrame(scene = Int64[], + flipx = Bool[], + door = Int64[], + furniture = Int64[], + move = Symbol[], + path_cost = Float64[]) + for (idx, move) in enumerate(moves) + i = 1 + while i <= max_per_move + # generate a room pair + pair = create_pair(templates, move, obstacle_weights, + path_params) + + # no valid pair generated, try again or finish + !valid_pair(pair, move; criteria...) && continue + + # organize and save + id = (idx - 1) * max_per_move + i + pc1, pc2 = pair[end-1:end] + # balance most complex door along L,R + # pc1 < pc2 ; odd ; result + # T ; T ; T + # T ; F ; F + # F ; T ; F + # F ; F ; T + flipx = !xor(pc1 < pc2, Bool((i-1) % 2)) + update_df!(df, id, move, flipx, pair) + + # save scenes as json + save_pair(scenes_out, id, pair) + + print("move $(idx): $(i)/$(max_per_move)\r") + i += 1 + end + println() + end + @show df + # saving summary / manifest + CSV.write("$(scenes_out).csv", df) + return nothing +end + +main(); diff --git a/scripts/stimuli/path_cost/generate_rooms.jl b/scripts/stimuli/path_cost/generate_rooms.jl new file mode 100644 index 0000000..81fbe68 --- /dev/null +++ b/scripts/stimuli/path_cost/generate_rooms.jl @@ -0,0 +1,217 @@ +using CSV +using Gen +using JSON +using DataFrames +using Statistics +using FunctionalScenes +using LinearAlgebra: norm +using FunctionalCollections + +# using Profile +# using StatProfilerHTML + +function valid_pair(pair::Tuple, m::Move; + min_abs_pc_thresh::Float64 = 5.0, + min_upper_bound = 0.32 + )::Bool + + (d1, d2, f, pc1, pc2) = pair + @show (pc1, pc2) + # f > 0 + f > 0 && + abs(pc1 - pc2) >= min_abs_pc_thresh && + min(pc1, pc2) <= min_upper_bound +end + +function gen_obstacle_weights(template::GridRoom; + pct_open::Float64 = 0.3, + side_buffer::Int64 = 1) + dims = steps(template) + # prevent furniture generated in either: + # -1 out of sight + # -2 blocking entrance exit + # -3 hard to detect spaces next to walls + weights = Matrix{Bool}(zeros(dims)) + # ensures that there is no furniture near the observer + start_x = Int64(ceil(last(dims) * pct_open)) + stop_x = last(dims) - 2 # nor blocking the exit + # buffer along sides + start_y = side_buffer + 1 + stop_y = first(dims) - side_buffer + weights[start_y:stop_y, start_x:stop_x] .= 1.0 + # vectorize for `furniture_gm` + PersistentVector(vec(weights)) +end + +function average_tile_position(r::GridRoom, tiles) + ny, _ = steps(r) + pos = zeros(2) + for t in tiles + pos[1] += ceil(t / ny) / ny - 0.5 + pos[2] += (t % ny) / ny - 0.5 + end + pos .*= 1/length(tiles) + return pos +end + +function select_obstacle(r::GridRoom, m::Move; + xbuffer::Float64 = 0.0, + ybuffer::Float64 = 0.3) + fs = furniture(r) + nf = length(fs) + raw_weights = zeros(nf) + @inbounds for i = 1:nf + f = fs[i] + valid_move(r, f, m) || continue + avg_pos = average_tile_position(r, f) + raw_weights[i] = 1.0 * ( + (avg_pos[1] > xbuffer) && + (abs(avg_pos[2]) < ybuffer)) + end + srw = sum(raw_weights) + srw == 0 && return 0 + ws = raw_weights ./ srw + categorical(ws) +end + +function create_pair(door_conditions::Vector{GridRoom}, + move::Move, + obstacle_weights::PersistentVector, + path_params::NoisyPath; + samples::Int64 = 100, + max_f::Int64 = 8, + max_size::Int64 = 4, + factor::Int64 = 2) + # generate furniture once and then apply to + # each door condition + template = door_conditions[1] + with_furn = + furniture_gm(template, obstacle_weights, max_f, max_size) + + # add the furniture and expand from 16x16 -> 32x32 + d1 = expand(with_furn, factor) # door1 already added + d2 = expand(add(with_furn, door_conditions[2]), factor) + + # pick a random obstacle to move + furn_selected = select_obstacle(d1, move) + + # measure the differences in path complexity between the two doors + pc_1, _ = noisy_path(d1, path_params; samples = samples) + pc_2, _ = noisy_path(d2, path_params; samples = samples) + + (d1, d2, furn_selected, pc_1, pc_2) +end + +function update_df!(df::DataFrame, id::Int64, move::Move, + flipx::Bool, pair::Tuple) + d1, d2, furn_selected, pc_1, pc_2 = pair + push!(df, (id, flipx, 1, furn_selected, move, pc_1)) + push!(df, (id, flipx, 2, furn_selected, move, pc_2)) + return nothing +end + +function save_pair(out::String, id::Int64, pair::Tuple) + d1, d2, _... = pair + display(d1) + open("$(out)/$(id)_1.json", "w") do f + _d = d1 |> json + write(f, _d) + end + open("$(out)/$(id)_2.json", "w") do f + _d = d2 |> json + write(f, _d) + end + return nothing +end + +function main() + # dataset name + name = "pathcost_3.0" + + dataset_out = "/spaths/datasets/$(name)" + isdir(dataset_out) || mkdir(dataset_out) + scenes_out = "$(dataset_out)/scenes" + isdir(scenes_out) || mkdir(scenes_out) + + # Parameters + room_dims = (16, 16) + entrance = [8, 9] + door_rows = [5, 12] + inds = LinearIndices(room_dims) + doors = inds[door_rows, room_dims[2]] + + # will only consider these moves + moves = [down_move, up_move] + + # Path planning + # leaving gamma(a,b) to default + path_params = NoisyPath( + obstacle_cost = 1.64, + # obstacle_cost = 2.0, + kernel_width = 7, + floor_cost = 0.05 + ) + + # Acceptance criteria, see `valid_pair` + criteria = Dict( + :min_abs_pc_thresh => 8.0, + :min_upper_bound => 35.0 + ) + + # number of trials + n = 20 + + # number of trials per move condition + max_per_move = Int64(ceil(n / length(moves))) + + # empty rooms with doors + t1 = GridRoom(room_dims, room_dims, entrance, [doors[1]]) + t2 = GridRoom(room_dims, room_dims, entrance, [doors[2]]) + templates = [t1, t2] + + obstacle_weights = gen_obstacle_weights(templates[1]) + + # will store summary of generated rooms here + df = DataFrame(scene = Int64[], + flipx = Bool[], + door = Int64[], + furniture = Int64[], + move = Symbol[], + path_cost = Float64[]) + for (idx, move) in enumerate(moves) + i = 1 + while i <= max_per_move + # generate a room pair + pair = create_pair(templates, move, obstacle_weights, + path_params; samples = 100) + + # no valid pair generated, try again or finish + !valid_pair(pair, move; criteria...) && continue + + # organize and save + id = (idx - 1) * max_per_move + i + pc1, pc2 = pair[end-1:end] + # balance most complex door along L,R + # pc1 < pc2 ; odd ; result + # T ; T ; T + # T ; F ; F + # F ; T ; F + # F ; F ; T + flipx = !xor(pc1 < pc2, Bool((i-1) % 2)) + update_df!(df, id, move, flipx, pair) + + # save scenes as json + save_pair(scenes_out, id, pair) + + print("move $(idx): $(i)/$(max_per_move)\r") + i += 1 + end + println() + end + @show df + # saving summary / manifest + CSV.write("$(scenes_out).csv", df) + return nothing +end + +main(); diff --git a/scripts/stimuli/render_rooms.jl b/scripts/stimuli/render_rooms.jl index 9e69e8a..be4af7e 100644 --- a/scripts/stimuli/render_rooms.jl +++ b/scripts/stimuli/render_rooms.jl @@ -9,7 +9,8 @@ using FunctionalScenes cycles_args = Dict( :mode => "full", # :mode => "none", - :navigation => false + :navigation => false, + :template => "/spaths/datasets/vss_template.blend" ) function render_stims(df::DataFrame, name::String; @@ -17,41 +18,37 @@ function render_stims(df::DataFrame, name::String; out = "/spaths/datasets/$(name)/render_cycles" isdir(out) || mkdir(out) for r in eachrow(df) - base_p = "/spaths/datasets/$(name)/scenes/$(r.id)_$(r.door).json" + base_p = "/spaths/datasets/$(name)/scenes/$(r.scene)_$(r.door).json" local base_s open(base_p, "r") do f base_s = JSON.parse(f) end base = from_json(GridRoom, base_s) - p = "$(out)/$(r.id)_$(r.door)" + p = "$(out)/$(r.scene)_$(r.door)" render(base, p; cycles_args...) room = shift_furniture(base, furniture(base)[r.furniture], Symbol(r.move)) - p = "$(out)/$(r.id)_$(r.door)_$(r.furniture)_$(r.move)" + p = "$(out)/$(r.scene)_$(r.door)_shifted" render(room, p; cycles_args...) end end function main() - # args = Dict( - # "dataset" => "vss_pilot_11f_32x32", - # "scene" => 1, - # "threads" => Sys.CPU_THREADS - # ) - args = parse_commandline() + cmd = ["pathcost_3.0", "0"] + args = parse_commandline(;x=cmd) name = args["dataset"] src = "/spaths/datasets/$(name)" df = DataFrame(CSV.File("$(src)/scenes.csv")) - seeds = unique(df.id) + seeds = unique(df.scene) if args["scene"] == 0 - seeds = unique(df.id) + seeds = unique(df.scene) else seeds = [args["scene"]] - df = df[df.id .== args["scene"], :] + df = df[df.scene .== args["scene"], :] end render_stims(df, name, @@ -62,7 +59,7 @@ end -function parse_commandline() +function parse_commandline(;x=ARGS) s = ArgParseSettings() @add_arg_table! s begin @@ -82,7 +79,7 @@ function parse_commandline() arg_type = Int64 default = 4 end - return parse_args(s) + return parse_args(x, s) end diff --git a/src/blender/render.py b/src/blender/render.py index 7f6b1f0..b55cc80 100644 --- a/src/blender/render.py +++ b/src/blender/render.py @@ -12,8 +12,6 @@ import time import argparse -import numpy as np - # Flush stdout in case blender is complaining sys.stdout.flush() diff --git a/src/dgp/dgp.jl b/src/dgp/dgp.jl index e618577..f65acfe 100644 --- a/src/dgp/dgp.jl +++ b/src/dgp/dgp.jl @@ -121,6 +121,9 @@ function is_floor(r::GridRoom, t::Int64)::Bool has_vertex(g, t) && d[t] == floor_tile end +function valid_move(r::Room, fid::Int64, m::Move)::Bool + valid_move(r, furniture(r)[fid], m) +end function valid_move(r::Room, f::Furniture, m::Move)::Bool g = pathgraph(r) mf = move(r, f, m) diff --git a/src/dgp/path_based/path_based.jl b/src/dgp/path_based/path_based.jl index b852ebc..f0d56e7 100644 --- a/src/dgp/path_based/path_based.jl +++ b/src/dgp/path_based/path_based.jl @@ -100,10 +100,14 @@ const MoveDeque = Vector{Tuple{Int64, Int64, Int64}} function noisy_distm(r::GridRoom, w::Float64) g = pathgraph(r) d = data(r) + nrow = size(d, 1) n = length(d) - m = Matrix{Float64}(undef, n, n) + # m = Matrix{Float64}(undef, n, n) + m = fill(Inf, (n, n)) @inbounds for i = 1:n, j = 1:n + vd = abs(i - j) == 1 + (vd == 1 || vd == nrow) || continue # case which di is (free tile, free tile) # m[i,j] should be 0.1 # case which di is (free_tile, obstacle) or any permutation @@ -185,4 +189,5 @@ function fix_shortest_path(r::GridRoom, p::Vector{Int64})::GridRoom new_r::GridRoom = @>> omat vec findall Set add(r) end -include("gen.jl") \ No newline at end of file +include("gen.jl") +include("path_cost.jl") diff --git a/src/dgp/path_based/path_cost.jl b/src/dgp/path_based/path_cost.jl new file mode 100644 index 0000000..18cfe73 --- /dev/null +++ b/src/dgp/path_based/path_cost.jl @@ -0,0 +1,105 @@ +using ImageFiltering + +export NoisyPath, noisy_path, path_cost, distance_to_path + +@with_kw struct NoisyPath + obstacle_cost::Float64 = 1.0 + floor_cost::Float64 = 0.1 + wall_cost_ratio::Float64 = 10.0 + wall_cost::Float64 = obstacle_cost * wall_cost_ratio + kernel_sigma::Float64 = 1.0 + kernel_width::Int64 = 7 + kernel_alpha::Float64 = 2.0 + kernel_beta::Float64 = 0.9 +end + +function nav_graph(r::GridRoom, params::NoisyPath) + nav_graph(r, params, params.kernel_sigma) +end +function nav_graph(r::GridRoom, params::NoisyPath, sigma::Float64) + @unpack obstacle_cost, floor_cost, wall_cost, kernel_width = params + d = data(r) + ws = fill(floor_cost, size(d)) + ws[d .== obstacle_tile] .+= obstacle_cost + ws[d .== wall_tile] .+= wall_cost + noisy_ws = imfilter(ws, Kernel.gaussian([sigma, sigma], + [kernel_width, kernel_width])) + n = length(d) + row = size(d, 1) + adm = fill(false, (n, n)) + dsm = fill(Inf, (n, n)) + + @inbounds for i = 1:(n-1), j = (i+1):n + delta = abs(i - j) + delta == 1 || delta == row || continue + adm[i, j] = adm[j, i] = true + dsm[i, j] = dsm[j, i] = noisy_ws[i] + noisy_ws[j] + end + (adm, dsm) +end + +function cart_dist(src, trg, n) + delta_x = ceil(src / n) - ceil(trg / n) + delta_y = src % n - trg % n + sqrt(delta_x^2 + delta_y^2) +end + +function avg_location(lvs, n::Int64) + center = zeros(2) + @inbounds for v in lvs + center[1] += ceil(v / n) + center[2] += v % n + end + center ./= length(lvs) + return center +end + +function Graphs.a_star(r::GridRoom, params::NoisyPath, sigma::Float64) + ent = first(entrance(r)) + ext = first(exits(r)) + ad, dm = nav_graph(r, params, sigma) + g = SimpleGraph(ad) + h = x -> cart_dist(x, ext, size(data(r), 1)) + path = a_star(g, ent, ext, dm, h) + path, dm +end + +function path_cost(path) + length(path) +end + +function path_cost(path, dm) + c::Float64 = 0.0 + @inbounds for step in path + c += dm[src(step), dst(step)] + end + return c +end + +function distance_to_path(vs, pmat) + n = size(pmat, 1) + loc = avg_location(vs, n) + d = 0 + for x = 1:size(pmat,2), y = 1:size(pmat, 1) + # occupancy weight * neg log of l2 distance + # d += pmat[y,x] * log( sqrt( (ceil(x/n) - loc[1])^2 + (y % n - loc[2])^2)) + d += pmat[y,x] * sqrt( (ceil(x/n) - loc[1])^2 + (y % n - loc[2])^2) + end + return d +end + +function noisy_path(room::GridRoom, params::NoisyPath; + samples::Int64 = 300) + c::Float64 = 0.0 + pmat = zeros(steps(room)) + for _ = 1:samples + # var = inv_gamma(1.2, 0.8) + var = gamma(params.kernel_alpha, params.kernel_beta) + path, dm = Graphs.a_star(room, params, sqrt(var)) + c += path_cost(path, dm) + @inbounds for step in path + pmat[dst(step)] += 1.0 + end + end + (c / samples, pmat ./ samples) +end diff --git a/test/dgp/dgp.jl b/test/dgp/dgp.jl index 5ac37cd..9db43ac 100644 --- a/test/dgp/dgp.jl +++ b/test/dgp/dgp.jl @@ -1,8 +1,63 @@ using Gen +using JSON +using Graphs +import Graphs: a_star +using ImageFiltering +using FileIO using FunctionalScenes +using Profile +using StatProfilerHTML + +function nav_graph(r::GridRoom, w::Float64) + d = data(r) + ws = zeros(size(d)) + ws[d .== obstacle_tile] .= 1.0 + noisy_ws = imfilter(ws, Kernel.gaussian(w)) + noisy_ws[d .== wall_tile] .= Inf + n = length(d) + row = size(d, 1) + adm = fill(false, (n, n)) + dsm = fill(Inf, (n, n)) + + @inbounds for i = 1:(n-1), j = (i+1):n + delta = abs(i - j) + delta == 1 || delta == row || continue + adm[i, j] = adm[j, i] = true + dsm[i, j] = dsm[j, i] = noisy_ws[i] + noisy_ws[j] + end + (adm, dsm) + +end + +function Graphs.a_star(r::GridRoom, w::Float64) + + ent = first(entrance(r)) + ext = first(exits(r)) + + ad, dm = nav_graph(r, w) + g = SimpleGraph(ad) + + path = a_star(g, ent, ext, dm) +end function mytest() - return nothing + name = "ccn_2023_exp" + base_p = "/spaths/datasets/$(name)/scenes/1_1.json" + local base_s + open(base_p, "r") do f + base_s = JSON.parse(f) + end + room = from_json(GridRoom, base_s) + path = a_star(room, 0.1) + ps = Int64[] + push!(ps, src(path[1])) + for step in path + push!(ps, dst(step)) + end + viz_room(room, ps) + # Profile.init(;n = 100000, delay = 1E-5) + # Profile.clear() + # @profilehtml a_star(room, 0.01) end mytest(); From 2130d9a3c0505b863a84c87fa52ddd8d17fe2f4e Mon Sep 17 00:00:00 2001 From: belledon Date: Fri, 26 May 2023 08:00:27 -0400 Subject: [PATCH 02/10] playing with different path algorithms --- scripts/analysis/scene_path_analysis.jl | 32 +++++++++++++----- src/dgp/path_based/path_cost.jl | 44 +++++++++++++++++++++++-- src/rooms/viz.jl | 14 +++++++- 3 files changed, 78 insertions(+), 12 deletions(-) diff --git a/scripts/analysis/scene_path_analysis.jl b/scripts/analysis/scene_path_analysis.jl index 6d07fa5..55e44dc 100644 --- a/scripts/analysis/scene_path_analysis.jl +++ b/scripts/analysis/scene_path_analysis.jl @@ -15,7 +15,7 @@ function main() src = "/spaths/datasets/$(name)" df = DataFrame(CSV.File("$(src)/scenes.csv")) - samples = 300 + samples = 20 n = nrow(df) * 2 @@ -23,13 +23,16 @@ function main() isdir(out) || mkdir(out) # for c = LinRange(0.5, 4.5, 8), k = [5,7,9] - # for c = LinRange(0.5, 4.5, 4), fc = LinRange(0.01, 0.5, 4), k = [7] - for c = [1.64], fc = [0.01], k = [7] + # for c = LinRange(1.0, 5.0, 4), fc = LinRange(0.25, 1.0, 4), k = [5] + # for c = LinRange(0.5, 2.5, 4), fc = LinRange(0.1, 1.0, 4), k = [7] + for c = [10.00], fc = [2.00], k = [7] # for c = [1.64], k = [7] params = NoisyPath( obstacle_cost = c, floor_cost = fc, - kernel_width = k + kernel_width = k, + kernel_sigma = 5.0, + wall_cost = 2*c, ) paths = Array{Float64}(undef, (30, 2, 2, 32, 32)) results = DataFrame(scene = Int64[], @@ -41,9 +44,12 @@ function main() floor_cost = Float64[], kernel_width = Int64[]) metric_out = "$(out)/$(c)_$(fc)_$(k)_path_metrics.csv" + @show metric_out isfile(metric_out) && continue for row in eachrow(df) + @show (row.scene) + # row.scene == 4 && break base_p = "/spaths/datasets/$(name)/scenes/$(row.scene)_$(row.door).json" local base_s open(base_p, "r") do f @@ -52,8 +58,12 @@ function main() base = from_json(GridRoom, base_s) to_shift = furniture(base)[row.furniture] - base_cost, base_path = noisy_path(base, params; - samples=samples) + # base_cost, base_path = noisy_path(base, params; + # samples=samples) + base_cost, base_path = noisy_shortest_paths(base, params; + k=samples) + viz_room(base, base_path) + base_dist = FunctionalScenes.distance_to_path(to_shift, base_path) paths[row.scene, row.door, 1, :, :] = base_path push!(results, (row.scene, row.door, false, base_cost, base_dist, c, fc, k)) @@ -61,13 +71,19 @@ function main() shifted = shift_furniture(base, to_shift, Symbol(row.move)) - shift_cost, shift_path = noisy_path(shifted, params; - samples=samples) + # shift_cost, shift_path = noisy_path(shifted, params; + # samples=samples) + shift_cost, shift_path = noisy_shortest_paths(shifted, params; + k=samples) + viz_room(shifted, shift_path) + paths[row.scene, row.door, 2, :, :] = shift_path shift_dist = FunctionalScenes.distance_to_path(to_shift, shift_path) push!(results, (row.scene, row.door, true, shift_cost, shift_dist, c, fc, k)) end + display(results) + np.save("$(out)/$(c)_$(fc)_$(k)_noisy_paths.npy", paths) CSV.write(metric_out, results) end diff --git a/src/dgp/path_based/path_cost.jl b/src/dgp/path_based/path_cost.jl index 18cfe73..24026d1 100644 --- a/src/dgp/path_based/path_cost.jl +++ b/src/dgp/path_based/path_cost.jl @@ -1,6 +1,7 @@ using ImageFiltering -export NoisyPath, noisy_path, path_cost, distance_to_path +export NoisyPath, noisy_path, path_cost, distance_to_path, + noisy_shortest_paths @with_kw struct NoisyPath obstacle_cost::Float64 = 1.0 @@ -24,6 +25,8 @@ function nav_graph(r::GridRoom, params::NoisyPath, sigma::Float64) ws[d .== wall_tile] .+= wall_cost noisy_ws = imfilter(ws, Kernel.gaussian([sigma, sigma], [kernel_width, kernel_width])) + noisy_ws[d .== wall_tile] .+= wall_cost + n = length(d) row = size(d, 1) adm = fill(false, (n, n)) @@ -35,7 +38,7 @@ function nav_graph(r::GridRoom, params::NoisyPath, sigma::Float64) adm[i, j] = adm[j, i] = true dsm[i, j] = dsm[j, i] = noisy_ws[i] + noisy_ws[j] end - (adm, dsm) + (noisy_ws, adm, dsm) end function cart_dist(src, trg, n) @@ -57,7 +60,7 @@ end function Graphs.a_star(r::GridRoom, params::NoisyPath, sigma::Float64) ent = first(entrance(r)) ext = first(exits(r)) - ad, dm = nav_graph(r, params, sigma) + _, ad, dm = nav_graph(r, params, sigma) g = SimpleGraph(ad) h = x -> cart_dist(x, ext, size(data(r), 1)) path = a_star(g, ent, ext, dm, h) @@ -76,6 +79,15 @@ function path_cost(path, dm) return c end + +function path_cost(path::Vector{Int64}, dm) + c::Float64 = 0.0 + @inbounds for step in path + c += dm[step] + end + return c +end + function distance_to_path(vs, pmat) n = size(pmat, 1) loc = avg_location(vs, n) @@ -103,3 +115,29 @@ function noisy_path(room::GridRoom, params::NoisyPath; end (c / samples, pmat ./ samples) end + +function noisy_k_paths(r::GridRoom, params::NoisyPath, k::Int64) + ent = first(entrance(r)) + ext = first(exits(r)) + ws, ad, dm = nav_graph(r, params) + g = SimpleGraph(ad) + st = yen_k_shortest_paths(g, ent, ext, dm, k) + st, ws +end + +function noisy_shortest_paths(room::GridRoom, params::NoisyPath; + k::Int64 = 20) + c::Float64 = 0.0 + pmat = zeros(steps(room)) + st, ws = noisy_k_paths(room, params, k) + @inbounds for i = 1:k + path = st.paths[i] + c += path_cost(path, ws) + @inbounds for v in path + pmat[v] += 1.0 + end + end + rmul!(pmat, 1/k) + c /= k + (c, pmat) +end diff --git a/src/rooms/viz.jl b/src/rooms/viz.jl index 2e16f04..9eab684 100644 --- a/src/rooms/viz.jl +++ b/src/rooms/viz.jl @@ -1,4 +1,5 @@ -using Images: colorview, RGB +# using Images: colorview, RGB +using Colors, Images using ImageInTerminal export viz_room @@ -7,6 +8,17 @@ function Base.display(r::GridRoom) viz_room(r) end + +function viz_room(r::GridRoom, p::Matrix{Float64}) + d = data(r) + reds = zeros(size(p)) + reds[d .== obstacle_tile] .= 1 + blues = zeros(size(p)) + blues[d .== wall_tile] .= 1 + m = colorview(RGB{Float64}, reds, p, blues) + display(rotr90(m, 3)) +end + function viz_room(r::GridRoom, p::Array{Int64}) d = data(r) m = fill(RGB{Float32}(0, 0, 0), steps(r)) From 2b208a486a23361abcf31ea6016dbf4e93ae4a61 Mon Sep 17 00:00:00 2001 From: belledon Date: Fri, 2 Jun 2023 11:17:33 -0400 Subject: [PATCH 03/10] checkpoint before new path noise procedure --- scripts/analysis/scene_path_analysis.jl | 51 +++++++++------ scripts/stimuli/path_cost/generate_rooms.jl | 70 ++++++++++++--------- scripts/stimuli/render_rooms.jl | 2 +- src/dgp/dgp.jl | 13 ++++ src/dgp/gen.jl | 39 +++++------- src/dgp/path_based/path_cost.jl | 65 +++++++++++++++++-- src/rooms/viz.jl | 22 ++++--- 7 files changed, 176 insertions(+), 86 deletions(-) diff --git a/scripts/analysis/scene_path_analysis.jl b/scripts/analysis/scene_path_analysis.jl index 55e44dc..bf39b82 100644 --- a/scripts/analysis/scene_path_analysis.jl +++ b/scripts/analysis/scene_path_analysis.jl @@ -3,6 +3,7 @@ using CSV using JSON using PyCall using FileIO +using Images using ArgParse using DataFrames using FunctionalScenes @@ -10,7 +11,18 @@ using Random np = pyimport("numpy") -name = "pathcost_3.0" +function save_path_render(out::String, scene::Int, door::Int, + isshifted::Bool, + r::GridRoom, path::Matrix{Float64}) + m = FunctionalScenes.draw_room(r, path) + m = imresize(m, (128,128)) + shifted = isshifted ? "shifted" : "unshifted" + save("$(out)/$(scene)_$(door)_$(shifted).png", m) + return nothing +end + +name = "ccn_2023_exp" +# name = "pathcost_4.0" function main() src = "/spaths/datasets/$(name)" @@ -19,30 +31,31 @@ function main() n = nrow(df) * 2 - out = "/spaths/datasets/$(name)_path" + out = "/spaths/datasets/$(name)/path_analysis" isdir(out) || mkdir(out) # for c = LinRange(0.5, 4.5, 8), k = [5,7,9] - # for c = LinRange(1.0, 5.0, 4), fc = LinRange(0.25, 1.0, 4), k = [5] - # for c = LinRange(0.5, 2.5, 4), fc = LinRange(0.1, 1.0, 4), k = [7] - for c = [10.00], fc = [2.00], k = [7] - # for c = [1.64], k = [7] + for c = [10.0], fc = [1.0], k = [7] params = NoisyPath( obstacle_cost = c, floor_cost = fc, kernel_width = k, kernel_sigma = 5.0, - wall_cost = 2*c, + wall_cost = 10.0 * c, + kernel_beta = 2.0 ) paths = Array{Float64}(undef, (30, 2, 2, 32, 32)) results = DataFrame(scene = Int64[], door = Int64[], is_shifted = Bool[], + obstacle_size = Int64[], path_cost = Float64[], path_dist = Float64[], obstacle_cost = Float64[], floor_cost = Float64[], kernel_width = Int64[]) + render_out = "$(out)/$(c)_$(fc)_$(k)_renders" + isdir(render_out) || mkdir(render_out) metric_out = "$(out)/$(c)_$(fc)_$(k)_path_metrics.csv" @show metric_out isfile(metric_out) && continue @@ -57,29 +70,29 @@ function main() end base = from_json(GridRoom, base_s) to_shift = furniture(base)[row.furniture] + obs_size = length(to_shift) - # base_cost, base_path = noisy_path(base, params; - # samples=samples) - base_cost, base_path = noisy_shortest_paths(base, params; - k=samples) - viz_room(base, base_path) + base_cost, base_path = noisy_path(base, params; + samples=samples) + save_path_render(render_out, row.scene, row.door, false, base, base_path) base_dist = FunctionalScenes.distance_to_path(to_shift, base_path) paths[row.scene, row.door, 1, :, :] = base_path - push!(results, (row.scene, row.door, false, base_cost, base_dist, c, fc, k)) + push!(results, (row.scene, row.door, false, obs_size, + base_cost, base_dist, c, fc, k)) + shifted = shift_furniture(base, to_shift, Symbol(row.move)) - # shift_cost, shift_path = noisy_path(shifted, params; - # samples=samples) - shift_cost, shift_path = noisy_shortest_paths(shifted, params; - k=samples) - viz_room(shifted, shift_path) + shift_cost, shift_path = noisy_path(shifted, params; + samples=samples) + save_path_render(render_out, row.scene, row.door, true, shifted, shift_path) paths[row.scene, row.door, 2, :, :] = shift_path shift_dist = FunctionalScenes.distance_to_path(to_shift, shift_path) - push!(results, (row.scene, row.door, true, shift_cost, shift_dist, c, fc, k)) + push!(results, (row.scene, row.door, true, obs_size, + shift_cost, shift_dist, c, fc, k)) end display(results) diff --git a/scripts/stimuli/path_cost/generate_rooms.jl b/scripts/stimuli/path_cost/generate_rooms.jl index 81fbe68..7248bf9 100644 --- a/scripts/stimuli/path_cost/generate_rooms.jl +++ b/scripts/stimuli/path_cost/generate_rooms.jl @@ -11,16 +11,20 @@ using FunctionalCollections # using StatProfilerHTML function valid_pair(pair::Tuple, m::Move; - min_abs_pc_thresh::Float64 = 5.0, - min_upper_bound = 0.32 + min_pc_thresh::Float64 = 5.0, + max_pc_thresh::Float64 = 0.32, + max_pc_diff_thresh::Float64 = 20.0, + min_pd_diff_thresh::Float64 = 3.0 )::Bool - (d1, d2, f, pc1, pc2) = pair - @show (pc1, pc2) - # f > 0 + @show pair[4:end] + (d1, d2, f, pc1, pc2, pd1, pd2) = pair + mu_pc = 0.5 * (pc1 + pc2) f > 0 && - abs(pc1 - pc2) >= min_abs_pc_thresh && - min(pc1, pc2) <= min_upper_bound + mu_pc > min_pc_thresh && + mu_pc < max_pc_thresh && + abs(pc1 - pc2) < max_pc_diff_thresh && + abs(pd1 - pd2) > min_pd_diff_thresh end function gen_obstacle_weights(template::GridRoom; @@ -69,9 +73,9 @@ function select_obstacle(r::GridRoom, m::Move; (abs(avg_pos[2]) < ybuffer)) end srw = sum(raw_weights) - srw == 0 && return 0 + srw == 0 && return (fs, 0) ws = raw_weights ./ srw - categorical(ws) + fs, categorical(ws) end function create_pair(door_conditions::Vector{GridRoom}, @@ -93,20 +97,23 @@ function create_pair(door_conditions::Vector{GridRoom}, d2 = expand(add(with_furn, door_conditions[2]), factor) # pick a random obstacle to move - furn_selected = select_obstacle(d1, move) - + f, fi = select_obstacle(d1, move) + # failed to select + fi == 0 && return (d1, d2, fi, 0, 0, 0, 0) # measure the differences in path complexity between the two doors - pc_1, _ = noisy_path(d1, path_params; samples = samples) - pc_2, _ = noisy_path(d2, path_params; samples = samples) + pc_1, p1 = noisy_path(d1, path_params; samples = samples) + pd_1 = FunctionalScenes.min_distance_to_path(f[fi], p1) + pc_2, p2 = noisy_path(d2, path_params; samples = samples) + pd_2 = FunctionalScenes.min_distance_to_path(f[fi], p2) - (d1, d2, furn_selected, pc_1, pc_2) + (d1, d2, fi, pc_1, pc_2, pd_1, pd_2) end function update_df!(df::DataFrame, id::Int64, move::Move, flipx::Bool, pair::Tuple) - d1, d2, furn_selected, pc_1, pc_2 = pair - push!(df, (id, flipx, 1, furn_selected, move, pc_1)) - push!(df, (id, flipx, 2, furn_selected, move, pc_2)) + d1, d2, furn_selected, pc_1, pc_2, pd_1, pd_2 = pair + push!(df, (id, flipx, 1, furn_selected, move, pc_1, pd_1)) + push!(df, (id, flipx, 2, furn_selected, move, pc_2, pd_2)) return nothing end @@ -126,7 +133,7 @@ end function main() # dataset name - name = "pathcost_3.0" + name = "pathcost_6.0" dataset_out = "/spaths/datasets/$(name)" isdir(dataset_out) || mkdir(dataset_out) @@ -143,19 +150,23 @@ function main() # will only consider these moves moves = [down_move, up_move] - # Path planning - # leaving gamma(a,b) to default + # Path planning parameters + # - 05/30/23 based on 5.2.0 results path_params = NoisyPath( - obstacle_cost = 1.64, - # obstacle_cost = 2.0, + obstacle_cost = 3.2, + floor_cost = 0.01, kernel_width = 7, - floor_cost = 0.05 + kernel_beta = 2.0, + kernel_sigma = 5.0, + wall_cost = 32.0, ) # Acceptance criteria, see `valid_pair` criteria = Dict( - :min_abs_pc_thresh => 8.0, - :min_upper_bound => 35.0 + :min_pc_thresh => 76.0, + :max_pc_thresh => 86.0, + :max_pc_diff_thresh => 7.5, + :min_pd_diff_thresh => 1.5, ) # number of trials @@ -177,27 +188,28 @@ function main() door = Int64[], furniture = Int64[], move = Symbol[], - path_cost = Float64[]) + path_cost = Float64[], + path_dist = Float64[]) for (idx, move) in enumerate(moves) i = 1 while i <= max_per_move # generate a room pair pair = create_pair(templates, move, obstacle_weights, - path_params; samples = 100) + path_params; samples = 250) # no valid pair generated, try again or finish !valid_pair(pair, move; criteria...) && continue # organize and save id = (idx - 1) * max_per_move + i - pc1, pc2 = pair[end-1:end] + pd1, pd2 = pair[end-1:end] # balance most complex door along L,R # pc1 < pc2 ; odd ; result # T ; T ; T # T ; F ; F # F ; T ; F # F ; F ; T - flipx = !xor(pc1 < pc2, Bool((i-1) % 2)) + flipx = !xor(pd1 < pd2, Bool((i-1) % 2)) update_df!(df, id, move, flipx, pair) # save scenes as json diff --git a/scripts/stimuli/render_rooms.jl b/scripts/stimuli/render_rooms.jl index be4af7e..50a5fbe 100644 --- a/scripts/stimuli/render_rooms.jl +++ b/scripts/stimuli/render_rooms.jl @@ -37,7 +37,7 @@ function render_stims(df::DataFrame, name::String; end function main() - cmd = ["pathcost_3.0", "0"] + cmd = ["pathcost_6.0", "0"] args = parse_commandline(;x=cmd) name = args["dataset"] diff --git a/src/dgp/dgp.jl b/src/dgp/dgp.jl index f65acfe..7b3bfab 100644 --- a/src/dgp/dgp.jl +++ b/src/dgp/dgp.jl @@ -211,6 +211,19 @@ function strongly_connected(r::GridRoom, f::Furniture, m::Move) return connected end + +function furniture_weights(r::GridRoom) + fs = furniture(r) + nf = length(fs) + possible_moves = Matrix{Bool}(undef, 4, nf) + @inbounds for i = 1:nf + possible_moves[:, i] = valid_moves(r, fs[i]) + end + move_counts = sum(possible_moves, dim = 2) + f_weights = move_counts ./ sum(move_counts) + (possible_moves, move_counts, f_weights) +end + # @gen functions include("gen.jl") include("path_based/path_based.jl") diff --git a/src/dgp/gen.jl b/src/dgp/gen.jl index b33cb67..a6b1b4c 100644 --- a/src/dgp/gen.jl +++ b/src/dgp/gen.jl @@ -99,25 +99,20 @@ end # furniture_chain = Gen.Unfold(furniture_step) -# """ -# Move a piece of furniture -# """ -# @gen function reorganize(r::Room) -# # pick a random furniture block, this will prefer larger pieces -# g = pathgraph(r) -# vs = @>> g vertices filter(v -> istype(g, v, :furniture)) -# n = length(vs) -# ps = fill(1.0/n, n) -# vi = @trace(categorical(ps), :block) -# v = vs[vi] -# f = connected(g, v) -# # find the valid moves and pick one at random -# # each move will be one unit -# moves = valid_moves(r, f) - -# inds = CartesianIndices(steps(r)) -# move_probs = moves ./ sum(moves) -# move_id = @trace(categorical(move_probs), :move) -# move = move_map[move_id] -# new_r = shift_furniture(r, f, move) -# end +""" +Move a piece of furniture +""" +@gen (static) function reorganize(r::GridRoom) + # pick a random furniture block, this will prefer larger pieces + possible_moves, move_counts, f_weights = + furniture_weights(r) + f_idx = @trace(categorical(f_weights), :furniture) + f = fs[f_idx] + + # find the valid moves and pick one at random + # each move will be one unit + m_weights = possible_moves[:, f_idx] ./ move_counts[f_idx] + m_idx = @trace(categorical(m_weights), :move) + move = move_map[m_idx] + new_r = shift_furniture(r, f, move) +end diff --git a/src/dgp/path_based/path_cost.jl b/src/dgp/path_based/path_cost.jl index 24026d1..87dfb00 100644 --- a/src/dgp/path_based/path_cost.jl +++ b/src/dgp/path_based/path_cost.jl @@ -1,7 +1,7 @@ using ImageFiltering export NoisyPath, noisy_path, path_cost, distance_to_path, - noisy_shortest_paths + noisy_shortest_paths, path_density @with_kw struct NoisyPath obstacle_cost::Float64 = 1.0 @@ -88,32 +88,85 @@ function path_cost(path::Vector{Int64}, dm) return c end +function kernel_from_linear(i::Int64, m::Matrix{Float64}, w::Int64) + ny= size(m, 1) + offset = Int64((w-1) / 2) + result::Float64 = 0. + for y = -offset:offset + yoffset = y * ny + for x = -offset:offset + xoffset = x + i + result += get(m, yoffset + xoffset, 1.0) + end + end + result / n +end + +function path_density(path::Vector{T}, m::Matrix{Float64}, w::Int64) where + {T <: Edge} + sm = sum(m) + d::Float64 = 0.0 + @inbouds for e = path + d += kernel_from_linear(dst(e), m, w) / sm + end + return d +end + function distance_to_path(vs, pmat) n = size(pmat, 1) loc = avg_location(vs, n) d = 0 + normedpmat = pmat ./ sum(pmat) for x = 1:size(pmat,2), y = 1:size(pmat, 1) # occupancy weight * neg log of l2 distance # d += pmat[y,x] * log( sqrt( (ceil(x/n) - loc[1])^2 + (y % n - loc[2])^2)) - d += pmat[y,x] * sqrt( (ceil(x/n) - loc[1])^2 + (y % n - loc[2])^2) + d += normedpmat[y,x] * + sqrt( (ceil(x/n) - loc[1])^2 + (y % n - loc[2])^2) end return d end +# function nearest_k_distance(vs, pmat) +# n = size(pmat, 1) +# loc = avg_location(vs, n) +# d = Inf +# ws = Matrix{Float64}(undef, size(pmat)) +# sum_pmat = sum(pmat) +# @inbounds for x = 1:size(pmat,2), y = 1:size(pmat, 1) +# ws[y, x] = sqrt( (ceil(x/n) - loc[1])^2 + (y % n - loc[2])^2) / +# (pmat[y,x] / sum_pmat) +# end + +# return d +# end + +function min_distance_to_path(vs, pmat) + # n = size(pmat, 1) + # loc = avg_location(vs, n) + # d = Inf + # for x = 1:size(pmat,2), y = 1:size(pmat, 1) + # # occupancy weight * neg log of l2 distance + # # d += pmat[y,x] * log( sqrt( (ceil(x/n) - loc[1])^2 + (y % n - loc[2])^2)) + # val = sqrt( (ceil(x/n) - loc[1])^2 + (y % n - loc[2])^2) / pmat[y,x] + # d = min(d, val) + # end + # return d +end + function noisy_path(room::GridRoom, params::NoisyPath; samples::Int64 = 300) c::Float64 = 0.0 pmat = zeros(steps(room)) for _ = 1:samples - # var = inv_gamma(1.2, 0.8) var = gamma(params.kernel_alpha, params.kernel_beta) path, dm = Graphs.a_star(room, params, sqrt(var)) - c += path_cost(path, dm) + c += path_density(path, dm) @inbounds for step in path - pmat[dst(step)] += 1.0 + pmat[dst(step)] += (1.0 / samples) end end - (c / samples, pmat ./ samples) + c /= samples + (c, pmat) end function noisy_k_paths(r::GridRoom, params::NoisyPath, k::Int64) diff --git a/src/rooms/viz.jl b/src/rooms/viz.jl index 9eab684..d05d3c2 100644 --- a/src/rooms/viz.jl +++ b/src/rooms/viz.jl @@ -8,24 +8,28 @@ function Base.display(r::GridRoom) viz_room(r) end +function draw_room(r::GridRoom, p::Array{Int64}) + d = data(r) + m = fill(RGB{Float32}(0, 0, 0), steps(r)) + m[d .== obstacle_tile] .= RGB{Float32}(1, 0, 0) + m[d .== wall_tile] .= RGB{Float32}(0, 0, 1) + m[p] .= RGB{Float32}(0, 1, 0) + rotr90(m, 3) +end -function viz_room(r::GridRoom, p::Matrix{Float64}) +function draw_room(r::GridRoom, p::Matrix{Float64}) d = data(r) reds = zeros(size(p)) reds[d .== obstacle_tile] .= 1 blues = zeros(size(p)) blues[d .== wall_tile] .= 1 m = colorview(RGB{Float64}, reds, p, blues) - display(rotr90(m, 3)) + rotr90(m, 3) end -function viz_room(r::GridRoom, p::Array{Int64}) - d = data(r) - m = fill(RGB{Float32}(0, 0, 0), steps(r)) - m[d .== obstacle_tile] .= RGB{Float32}(1, 0, 0) - m[d .== wall_tile] .= RGB{Float32}(0, 0, 1) - m[p] .= RGB{Float32}(0, 1, 0) - display(rotr90(m, 3)) +function viz_room(r::GridRoom, p::Array) + m = draw_room(r, p) + display(m) end function viz_room(r::GridRoom) From 2f30a25945f479c10c84430c994ce9f054f039f2 Mon Sep 17 00:00:00 2001 From: belledon Date: Sat, 3 Jun 2023 09:13:50 -0400 Subject: [PATCH 04/10] switching to deterministic planning --- scripts/analysis/scene_path_analysis.jl | 34 +++--- src/dgp/dgp.jl | 32 ++--- src/dgp/gen.jl | 23 +++- src/dgp/path_based/path_cost.jl | 154 ++++++++++++++---------- src/rooms/furniture.jl | 31 ++++- 5 files changed, 156 insertions(+), 118 deletions(-) diff --git a/scripts/analysis/scene_path_analysis.jl b/scripts/analysis/scene_path_analysis.jl index bf39b82..31ca3bc 100644 --- a/scripts/analysis/scene_path_analysis.jl +++ b/scripts/analysis/scene_path_analysis.jl @@ -27,22 +27,19 @@ function main() src = "/spaths/datasets/$(name)" df = DataFrame(CSV.File("$(src)/scenes.csv")) - samples = 20 + samples = 100 n = nrow(df) * 2 out = "/spaths/datasets/$(name)/path_analysis" isdir(out) || mkdir(out) - # for c = LinRange(0.5, 4.5, 8), k = [5,7,9] - for c = [10.0], fc = [1.0], k = [7] - params = NoisyPath( + fc = 1.0 + for c = LinRange(0.5, 20, 20), k = [5,7,9] + for c = [5.0], fc = [1.0] + params = AStarPath( obstacle_cost = c, floor_cost = fc, - kernel_width = k, - kernel_sigma = 5.0, - wall_cost = 10.0 * c, - kernel_beta = 2.0 ) paths = Array{Float64}(undef, (30, 2, 2, 32, 32)) results = DataFrame(scene = Int64[], @@ -52,11 +49,10 @@ function main() path_cost = Float64[], path_dist = Float64[], obstacle_cost = Float64[], - floor_cost = Float64[], - kernel_width = Int64[]) - render_out = "$(out)/$(c)_$(fc)_$(k)_renders" + floor_cost = Float64[]) + render_out = "$(out)/$(c)_$(fc)_renders" isdir(render_out) || mkdir(render_out) - metric_out = "$(out)/$(c)_$(fc)_$(k)_path_metrics.csv" + metric_out = "$(out)/$(c)_$(fc)_path_metrics.csv" @show metric_out isfile(metric_out) && continue for row in eachrow(df) @@ -72,32 +68,32 @@ function main() to_shift = furniture(base)[row.furniture] obs_size = length(to_shift) - base_cost, base_path = noisy_path(base, params; + base_cost, base_path = astar_path(base, params; samples=samples) save_path_render(render_out, row.scene, row.door, false, base, base_path) - base_dist = FunctionalScenes.distance_to_path(to_shift, base_path) + base_dist = FunctionalScenes.distance_to_path(base,to_shift, base_path) paths[row.scene, row.door, 1, :, :] = base_path push!(results, (row.scene, row.door, false, obs_size, - base_cost, base_dist, c, fc, k)) + base_cost, base_dist, c, fc)) shifted = shift_furniture(base, to_shift, Symbol(row.move)) - shift_cost, shift_path = noisy_path(shifted, params; + shift_cost, shift_path = astar_path(shifted, params; samples=samples) save_path_render(render_out, row.scene, row.door, true, shifted, shift_path) paths[row.scene, row.door, 2, :, :] = shift_path - shift_dist = FunctionalScenes.distance_to_path(to_shift, shift_path) + shift_dist = FunctionalScenes.distance_to_path(shifted, to_shift, shift_path) push!(results, (row.scene, row.door, true, obs_size, - shift_cost, shift_dist, c, fc, k)) + shift_cost, shift_dist, c, fc)) end display(results) - np.save("$(out)/$(c)_$(fc)_$(k)_noisy_paths.npy", paths) + np.save("$(out)/$(c)_$(fc)_noisy_paths.npy", paths) CSV.write(metric_out, results) end end diff --git a/src/dgp/dgp.jl b/src/dgp/dgp.jl index 7b3bfab..a82b713 100644 --- a/src/dgp/dgp.jl +++ b/src/dgp/dgp.jl @@ -121,28 +121,6 @@ function is_floor(r::GridRoom, t::Int64)::Bool has_vertex(g, t) && d[t] == floor_tile end -function valid_move(r::Room, fid::Int64, m::Move)::Bool - valid_move(r, furniture(r)[fid], m) -end -function valid_move(r::Room, f::Furniture, m::Move)::Bool - g = pathgraph(r) - mf = move(r, f, m) - @>> setdiff(mf, f) begin - collect(Int64) - map(v -> is_floor(r, v)) - all - end -end - -function valid_moves(r::Room, f::Furniture)::BitVector - g = pathgraph(r) - vs = vertices(g) - moves = Vector{Bool}(undef, 4) - @inbounds for i = 1:4 - moves[i] = valid_move(r, f, move_map[i]) - end - BitVector(moves) -end function purge_around!(vm::Vector{Bool}, r::GridRoom, f::Furniture) # want to prevent "stitching" new pieces together @@ -219,9 +197,13 @@ function furniture_weights(r::GridRoom) @inbounds for i = 1:nf possible_moves[:, i] = valid_moves(r, fs[i]) end - move_counts = sum(possible_moves, dim = 2) - f_weights = move_counts ./ sum(move_counts) - (possible_moves, move_counts, f_weights) + move_counts = sum(possible_moves; dims = 1) + f_weights = vec(move_counts ./ sum(move_counts)) + (fs, possible_moves, move_counts, f_weights) +end + +function move_weights(possible_moves, move_counts, f_idx) + vec(possible_moves[:, f_idx] / move_counts[f_idx]) end # @gen functions diff --git a/src/dgp/gen.jl b/src/dgp/gen.jl index a6b1b4c..43936fa 100644 --- a/src/dgp/gen.jl +++ b/src/dgp/gen.jl @@ -97,22 +97,37 @@ Adds a randomly generated piece of furniture return result end -# furniture_chain = Gen.Unfold(furniture_step) +@gen (static) function reorganize_furniture(fi::Int64, r::GridRoom, furniture) + m_idx = @trace(categorical(fill(0.25, 4)), :move) + move = move_map[m_idx] + f = furniture[fi] + new_r::GridRoom = shift_furniture(r, f, move) + return new_r +end """ Move a piece of furniture """ +# @gen (static) function reorganize(r::GridRoom) +# fs = furniture(r) +# nf = length(fs) +# stages = +# @trace(Unfold(reorganize_furniture)(nf, r, fs), :furniture) +# result::GridRoom = last(stages) +# return result +# end @gen (static) function reorganize(r::GridRoom) # pick a random furniture block, this will prefer larger pieces - possible_moves, move_counts, f_weights = + fs, possible_moves, move_counts, f_weights = furniture_weights(r) f_idx = @trace(categorical(f_weights), :furniture) f = fs[f_idx] # find the valid moves and pick one at random # each move will be one unit - m_weights = possible_moves[:, f_idx] ./ move_counts[f_idx] + m_weights = move_weights(possible_moves, move_counts, f_idx) m_idx = @trace(categorical(m_weights), :move) move = move_map[m_idx] - new_r = shift_furniture(r, f, move) + result::GridRoom = shift_furniture(r, f, move) + return result end diff --git a/src/dgp/path_based/path_cost.jl b/src/dgp/path_based/path_cost.jl index 87dfb00..f580df1 100644 --- a/src/dgp/path_based/path_cost.jl +++ b/src/dgp/path_based/path_cost.jl @@ -1,9 +1,50 @@ using ImageFiltering -export NoisyPath, noisy_path, path_cost, distance_to_path, - noisy_shortest_paths, path_density +export PathProcedure, AStarPath, astar_path, + path_density, distance_to_path -@with_kw struct NoisyPath +abstract type PathProcedure end + +@with_kw struct AStarPath <: PathProcedure + obstacle_cost::Float64 = 1.0 + floor_cost::Float64 = 0.1 + wall_cost_ratio::Float64 = 10.0 + wall_cost::Float64 = obstacle_cost * wall_cost_ratio +end + +function nav_graph(r::GridRoom, params::AStarPath) + @unpack obstacle_cost, floor_cost, wall_cost = params + d = data(r) + ws = fill(floor_cost, size(d)) + ws[d .== obstacle_tile] .+= obstacle_cost + ws[d .== wall_tile] .+= wall_cost + + n = length(d) + row = size(d, 1) + adm = fill(false, (n, n)) + dsm = fill(Inf, (n, n)) + + @inbounds for i = 1:(n-1), j = (i+1):n + delta = abs(i - j) + delta == 1 || delta == row || continue + adm[i, j] = adm[j, i] = true + dsm[i, j] = dsm[j, i] = ws[i] + ws[j] + end + (ws, adm, dsm) +end + +function Graphs.a_star(r::GridRoom, params::AStarPath) + ent = first(entrance(r)) + ext = first(exits(r)) + g = pathgraph(r) + w, ad, dm = nav_graph(r, params) + # g = SimpleGraph(ad) + h = x -> round(cart_dist(x, ext, size(data(r), 1))) + path = a_star(g, ent, ext, weights(g), h) + path, w, ad, dm +end + +@with_kw struct NoisyPath <: PathProcedure obstacle_cost::Float64 = 1.0 floor_cost::Float64 = 0.1 wall_cost_ratio::Float64 = 10.0 @@ -60,8 +101,8 @@ end function Graphs.a_star(r::GridRoom, params::NoisyPath, sigma::Float64) ent = first(entrance(r)) ext = first(exits(r)) - _, ad, dm = nav_graph(r, params, sigma) - g = SimpleGraph(ad) + # _, ad, dm = nav_graph(r, params, sigma) + # g = simplegraph(ad) h = x -> cart_dist(x, ext, size(data(r), 1)) path = a_star(g, ent, ext, dm, h) path, dm @@ -99,33 +140,46 @@ function kernel_from_linear(i::Int64, m::Matrix{Float64}, w::Int64) result += get(m, yoffset + xoffset, 1.0) end end - result / n + result / (w ^ 2) end -function path_density(path::Vector{T}, m::Matrix{Float64}, w::Int64) where +function path_density(m::Matrix{Float64}, path::Vector{T}, w::Int64) where {T <: Edge} - sm = sum(m) + # m = Matrix{Float64}(data(r) .== obstacle_tile) d::Float64 = 0.0 - @inbouds for e = path - d += kernel_from_linear(dst(e), m, w) / sm + @inbounds for e = path + d += kernel_from_linear(dst(e), m, w) end return d end -function distance_to_path(vs, pmat) +function distance_to_path(r::GridRoom, vs, pmat::Matrix{Float64}) + n = steps(r)[2] n = size(pmat, 1) loc = avg_location(vs, n) d = 0 - normedpmat = pmat ./ sum(pmat) - for x = 1:size(pmat,2), y = 1:size(pmat, 1) - # occupancy weight * neg log of l2 distance - # d += pmat[y,x] * log( sqrt( (ceil(x/n) - loc[1])^2 + (y % n - loc[2])^2)) - d += normedpmat[y,x] * + spmat = sum(pmat) + @inbounds for x = 1:size(pmat,2), y = 1:size(pmat, 1) + d += (pmat[y,x] / spmat) * sqrt( (ceil(x/n) - loc[1])^2 + (y % n - loc[2])^2) end return d end + +function distance_to_path(r::GridRoom, vs, path::Array{T}) where {T<:Edge} + n = steps(r)[2] + loc = avg_location(vs, n) + ne = length(path) + d::Float64 = 0.0 + for e in path + v = dst(e) + x = ceil(v / n), y = v % n + d += sqrt((x - loc[1])^2 + (y - loc[2])^2) + end + return d / ne +end + # function nearest_k_distance(vs, pmat) # n = size(pmat, 1) # loc = avg_location(vs, n) @@ -140,57 +194,25 @@ end # return d # end -function min_distance_to_path(vs, pmat) - # n = size(pmat, 1) - # loc = avg_location(vs, n) - # d = Inf - # for x = 1:size(pmat,2), y = 1:size(pmat, 1) - # # occupancy weight * neg log of l2 distance - # # d += pmat[y,x] * log( sqrt( (ceil(x/n) - loc[1])^2 + (y % n - loc[2])^2)) - # val = sqrt( (ceil(x/n) - loc[1])^2 + (y % n - loc[2])^2) / pmat[y,x] - # d = min(d, val) - # end - # return d -end - -function noisy_path(room::GridRoom, params::NoisyPath; - samples::Int64 = 300) - c::Float64 = 0.0 - pmat = zeros(steps(room)) - for _ = 1:samples - var = gamma(params.kernel_alpha, params.kernel_beta) - path, dm = Graphs.a_star(room, params, sqrt(var)) - c += path_density(path, dm) - @inbounds for step in path - pmat[dst(step)] += (1.0 / samples) - end - end - c /= samples - (c, pmat) -end - -function noisy_k_paths(r::GridRoom, params::NoisyPath, k::Int64) - ent = first(entrance(r)) - ext = first(exits(r)) - ws, ad, dm = nav_graph(r, params) - g = SimpleGraph(ad) - st = yen_k_shortest_paths(g, ent, ext, dm, k) - st, ws -end - -function noisy_shortest_paths(room::GridRoom, params::NoisyPath; - k::Int64 = 20) - c::Float64 = 0.0 +function astar_path(room::GridRoom, params::AStarPath; + kernel::Int64 = 5, + samples::Int64 = 50) pmat = zeros(steps(room)) - st, ws = noisy_k_paths(room, params, k) - @inbounds for i = 1:k - path = st.paths[i] - c += path_cost(path, ws) - @inbounds for v in path - pmat[v] += 1.0 - end + path, w, _... = Graphs.a_star(room, params) + c = path_density(w, path, kernel) + @inbounds for step in path + pmat[dst(step)] += 1.0 end - rmul!(pmat, 1/k) - c /= k + # c::Float64 = 0.0 + # pmat = zeros(steps(room)) + # for _ = 1:samples + # sample = reorganize(room) + # path, w, _... = Graphs.a_star(sample, params) + # c += path_density(w, path, kernel) + # @inbounds for step in path + # pmat[dst(step)] += (1.0 / samples) + # end + # end + # c /= samples (c, pmat) end diff --git a/src/rooms/furniture.jl b/src/rooms/furniture.jl index e8a302f..ce84d63 100644 --- a/src/rooms/furniture.jl +++ b/src/rooms/furniture.jl @@ -54,24 +54,47 @@ function remove(r::GridRoom, f::Furniture)::GridRoom r.exits, g, d) end -function clear_room(r::Room)::Room +function clear_room(r::GridRoom)::Room g = @> r steps grid PathGraph d = deepcopy(r.data) d[d .== obstacle_tile] .= floor_tile prune_edges!(g, d) - GridRoom(r.steps, r.bounds, r.entrance, + GridGridRoom(r.steps, r.bounds, r.entrance, r.exits, g, d) end -function shift_furniture(r::Room, f::Furniture, m::Symbol) +function valid_move(r::GridRoom, fid::Int64, m::Move)::Bool + valid_move(r, furniture(r)[fid], m) +end +function valid_move(r::GridRoom, f::Furniture, m::Move)::Bool + mf = move(r, f, m) + @>> setdiff(mf, f) begin + collect(Int64) + map(v -> is_floor(r, v)) + all + end +end + +function valid_moves(r::GridRoom, f::Furniture)::BitVector + vs = vertices(pathgraph(r)) + moves = Vector{Bool}(undef, 4) + @inbounds for i = 1:4 + moves[i] = valid_move(r, f, move_map[i]) + end + BitVector(moves) +end + +function shift_furniture(r::GridRoom, f::Furniture, m::Symbol) shift_furniture(r, f, move_d[m]) end -function shift_furniture(r::Room, f::Furniture, m::Int64) +function shift_furniture(r::GridRoom, f::Furniture, m::Int64) shift_furniture(r, f, move_map[m]) end function shift_furniture(r::GridRoom, f::Furniture, m::Move) @assert all(r.data[f] .== obstacle_tile) + g = pathgraph(r) + !valid_move(r, f, m) && return r d = deepcopy(r.data) # apply move moved_f = move(r, f, m) From 87f67bd10941eb216ddfd711865e8a0349f33267 Mon Sep 17 00:00:00 2001 From: belledon Date: Thu, 3 Aug 2023 10:44:45 -0400 Subject: [PATCH 05/10] checkpoint for new datasets --- Manifest.toml | 2 +- Project.toml | 1 + scripts/analysis/scene_path_analysis.jl | 89 +++++++---- src/dgp/path_based/path_cost.jl | 200 ++++++++++++++++-------- src/rooms/furniture.jl | 4 +- src/rooms/viz.jl | 8 +- 6 files changed, 209 insertions(+), 95 deletions(-) diff --git a/Manifest.toml b/Manifest.toml index 727491a..93e657d 100644 --- a/Manifest.toml +++ b/Manifest.toml @@ -2,7 +2,7 @@ julia_version = "1.8.5" manifest_format = "2.0" -project_hash = "b6889fb245dbf3623cf08e4c7a3c1d64518e2f41" +project_hash = "7e39308f2fd25b1f709f686ee7e2b898897a0895" [[deps.AbstractFFTs]] deps = ["ChainRulesCore", "LinearAlgebra"] diff --git a/Project.toml b/Project.toml index 64b1955..c5b76c5 100644 --- a/Project.toml +++ b/Project.toml @@ -30,6 +30,7 @@ OptimalTransport = "7e02d93a-ae51-4f58-b602-d97af76e3b33" OrderedCollections = "bac558e1-5e72-5ebc-8fee-abe8a469f55d" Parameters = "d96e819e-fc66-5662-9728-84c9c7592b0a" PyCall = "438e738f-606a-5dbb-bf0a-cddfbfd45ab0" +Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" Revise = "295af30f-e4ad-537b-8983-00126c2a3abe" Setfield = "efcf1570-3423-57d1-acb7-fd33fddbac46" SimpleWeightedGraphs = "47aef6b3-ad0c-573a-a1e2-d07658019622" diff --git a/scripts/analysis/scene_path_analysis.jl b/scripts/analysis/scene_path_analysis.jl index 31ca3bc..694b541 100644 --- a/scripts/analysis/scene_path_analysis.jl +++ b/scripts/analysis/scene_path_analysis.jl @@ -13,7 +13,7 @@ np = pyimport("numpy") function save_path_render(out::String, scene::Int, door::Int, isshifted::Bool, - r::GridRoom, path::Matrix{Float64}) + r::GridRoom, path) m = FunctionalScenes.draw_room(r, path) m = imresize(m, (128,128)) shifted = isshifted ? "shifted" : "unshifted" @@ -27,38 +27,58 @@ function main() src = "/spaths/datasets/$(name)" df = DataFrame(CSV.File("$(src)/scenes.csv")) - samples = 100 n = nrow(df) * 2 out = "/spaths/datasets/$(name)/path_analysis" isdir(out) || mkdir(out) + fc = 1.0 - for c = LinRange(0.5, 20, 20), k = [5,7,9] - for c = [5.0], fc = [1.0] - params = AStarPath( + # for c = LinRange(0.1, 5.0, 5), k = [5,7,9] + for c = [32.0], k = [5] + # params = AStarPath( + # obstacle_cost = c, + # floor_cost = fc, + # ) + params = NoisyPath( obstacle_cost = c, floor_cost = fc, + kernel_sigma = 3.0, + kernel_width = k, + ) + analysis_params = Dict( + :kernel => k, + :p => 0.35, + :n => 7 ) - paths = Array{Float64}(undef, (30, 2, 2, 32, 32)) + param_data = Dict{Symbol, Any}( + :obstacle_cost => c, + :floor_cost => fc, + :kernel_width => k) + # paths = Array{Float64}(undef, (30, 2, 2, 32, 32)) results = DataFrame(scene = Int64[], door = Int64[], is_shifted = Bool[], obstacle_size = Int64[], - path_cost = Float64[], + density = Float64[], + diffusion_ct = Float64[], + diffusion_ct_max = Float64[], + diffusion_ct_alt = Float64[], + diffusion_prop = Float64[], + diffusion_tot = Float64[], path_dist = Float64[], + path_length = Int64[], obstacle_cost = Float64[], - floor_cost = Float64[]) - render_out = "$(out)/$(c)_$(fc)_renders" + floor_cost = Float64[], + kernel_width = Int64[]) + render_out = "$(out)/$(c)_$(fc)_$(k)_renders" isdir(render_out) || mkdir(render_out) - metric_out = "$(out)/$(c)_$(fc)_path_metrics.csv" + metric_out = "$(out)/$(c)_$(fc)_$(k)_path_metrics.csv" @show metric_out - isfile(metric_out) && continue + # isfile(metric_out) && continue for row in eachrow(df) - @show (row.scene) - # row.scene == 4 && break base_p = "/spaths/datasets/$(name)/scenes/$(row.scene)_$(row.door).json" local base_s open(base_p, "r") do f @@ -68,32 +88,43 @@ function main() to_shift = furniture(base)[row.furniture] obs_size = length(to_shift) - base_cost, base_path = astar_path(base, params; - samples=samples) - save_path_render(render_out, row.scene, row.door, false, base, base_path) + scene_data = Dict{Symbol, Any}( + :scene => row.scene, + :door => row.door, + :obstacle_size => obs_size) + + base_path, base_result = path_analysis(base, params, to_shift; + analysis_params...) + + save_path_render(render_out, row.scene, row.door, false, base, + base_path) - base_dist = FunctionalScenes.distance_to_path(base,to_shift, base_path) - paths[row.scene, row.door, 1, :, :] = base_path - push!(results, (row.scene, row.door, false, obs_size, - base_cost, base_dist, c, fc)) + # paths[row.scene, row.door, 1, :, :] = base_path + trial_data = Dict{Symbol, Any}(:is_shifted => false) + merge!(trial_data, base_result, scene_data, param_data) + push!(results, trial_data) + + # shifted = remove(base, to_shift) shifted = shift_furniture(base, to_shift, Symbol(row.move)) - shift_cost, shift_path = astar_path(shifted, params; - samples=samples) - save_path_render(render_out, row.scene, row.door, true, shifted, shift_path) - - paths[row.scene, row.door, 2, :, :] = shift_path - shift_dist = FunctionalScenes.distance_to_path(shifted, to_shift, shift_path) - push!(results, (row.scene, row.door, true, obs_size, - shift_cost, shift_dist, c, fc)) + shifted_path, shifted_result = path_analysis(shifted, params, to_shift; + analysis_params...) + + save_path_render(render_out, row.scene, row.door, true, shifted, + shifted_path) + + # paths[row.scene, row.door, 2, :, :] = shift_path + trial_data = Dict{Symbol, Any}(:is_shifted => true) + merge!(trial_data, shifted_result, scene_data, param_data) + push!(results, trial_data) end display(results) - np.save("$(out)/$(c)_$(fc)_noisy_paths.npy", paths) + # np.save("$(out)/$(c)_$(fc)_$(k)_noisy_paths.npy", paths) CSV.write(metric_out, results) end end diff --git a/src/dgp/path_based/path_cost.jl b/src/dgp/path_based/path_cost.jl index f580df1..0d814ab 100644 --- a/src/dgp/path_based/path_cost.jl +++ b/src/dgp/path_based/path_cost.jl @@ -1,6 +1,7 @@ using ImageFiltering +using Random -export PathProcedure, AStarPath, astar_path, +export PathProcedure, AStarPath, NoisyPath, path_analysis, path_density, distance_to_path abstract type PathProcedure end @@ -16,8 +17,8 @@ function nav_graph(r::GridRoom, params::AStarPath) @unpack obstacle_cost, floor_cost, wall_cost = params d = data(r) ws = fill(floor_cost, size(d)) - ws[d .== obstacle_tile] .+= obstacle_cost - ws[d .== wall_tile] .+= wall_cost + ws[d .== obstacle_tile] .= obstacle_cost + ws[d .== wall_tile] .= wall_cost n = length(d) row = size(d, 1) @@ -33,12 +34,11 @@ function nav_graph(r::GridRoom, params::AStarPath) (ws, adm, dsm) end -function Graphs.a_star(r::GridRoom, params::AStarPath) +function path_procedure(r::GridRoom, params::AStarPath) ent = first(entrance(r)) ext = first(exits(r)) g = pathgraph(r) w, ad, dm = nav_graph(r, params) - # g = SimpleGraph(ad) h = x -> round(cart_dist(x, ext, size(data(r), 1))) path = a_star(g, ent, ext, weights(g), h) path, w, ad, dm @@ -51,8 +51,6 @@ end wall_cost::Float64 = obstacle_cost * wall_cost_ratio kernel_sigma::Float64 = 1.0 kernel_width::Int64 = 7 - kernel_alpha::Float64 = 2.0 - kernel_beta::Float64 = 0.9 end function nav_graph(r::GridRoom, params::NoisyPath) @@ -62,11 +60,11 @@ function nav_graph(r::GridRoom, params::NoisyPath, sigma::Float64) @unpack obstacle_cost, floor_cost, wall_cost, kernel_width = params d = data(r) ws = fill(floor_cost, size(d)) - ws[d .== obstacle_tile] .+= obstacle_cost - ws[d .== wall_tile] .+= wall_cost + ws[d .== obstacle_tile] .= obstacle_cost + ws[d .== wall_tile] .= obstacle_cost noisy_ws = imfilter(ws, Kernel.gaussian([sigma, sigma], [kernel_width, kernel_width])) - noisy_ws[d .== wall_tile] .+= wall_cost + noisy_ws[d .== wall_tile] .= wall_cost n = length(d) row = size(d, 1) @@ -82,6 +80,19 @@ function nav_graph(r::GridRoom, params::NoisyPath, sigma::Float64) (noisy_ws, adm, dsm) end +path_procedure(r::GridRoom, params::NoisyPath) = path_procedure(r, params, + params.kernel_sigma) + +function path_procedure(r::GridRoom, params::NoisyPath, sigma::Float64) + ent = first(entrance(r)) + ext = last(exits(r)) + w, ad, dm = nav_graph(r, params, sigma) + g = SimpleGraph(ad) + h = x -> cart_dist(x, ext, size(data(r), 1)) + path = a_star(g, ent, ext, dm, h) + path, w, ad, dm +end + function cart_dist(src, trg, n) delta_x = ceil(src / n) - ceil(trg / n) delta_y = src % n - trg % n @@ -98,16 +109,6 @@ function avg_location(lvs, n::Int64) return center end -function Graphs.a_star(r::GridRoom, params::NoisyPath, sigma::Float64) - ent = first(entrance(r)) - ext = first(exits(r)) - # _, ad, dm = nav_graph(r, params, sigma) - # g = simplegraph(ad) - h = x -> cart_dist(x, ext, size(data(r), 1)) - path = a_star(g, ent, ext, dm, h) - path, dm -end - function path_cost(path) length(path) end @@ -132,12 +133,14 @@ end function kernel_from_linear(i::Int64, m::Matrix{Float64}, w::Int64) ny= size(m, 1) offset = Int64((w-1) / 2) + mx = @inbounds m[1] # HACK: should be wall tile result::Float64 = 0. for y = -offset:offset yoffset = y * ny for x = -offset:offset xoffset = x + i - result += get(m, yoffset + xoffset, 1.0) + scale = exp(-sqrt(x^2 + y^2)/sqrt(w)) + result += scale * get(m, yoffset + xoffset, mx) end end result / (w ^ 2) @@ -171,48 +174,123 @@ function distance_to_path(r::GridRoom, vs, path::Array{T}) where {T<:Edge} n = steps(r)[2] loc = avg_location(vs, n) ne = length(path) - d::Float64 = 0.0 + # d::Float64 = 0.0 + # for e in path + # v = dst(e) + # x = ceil(v / n) + # y = v % n + # d += sqrt((x - loc[1])^2 + (y - loc[2])^2) + # end + # return d / ne + d::Float64 = Inf for e in path v = dst(e) - x = ceil(v / n), y = v % n - d += sqrt((x - loc[1])^2 + (y - loc[2])^2) + x = ceil(v / n) + y = v % n + d = min(sqrt((x - loc[1])^2 + (y - loc[2])^2), d) end - return d / ne -end - -# function nearest_k_distance(vs, pmat) -# n = size(pmat, 1) -# loc = avg_location(vs, n) -# d = Inf -# ws = Matrix{Float64}(undef, size(pmat)) -# sum_pmat = sum(pmat) -# @inbounds for x = 1:size(pmat,2), y = 1:size(pmat, 1) -# ws[y, x] = sqrt( (ceil(x/n) - loc[1])^2 + (y % n - loc[2])^2) / -# (pmat[y,x] / sum_pmat) -# end - -# return d -# end - -function astar_path(room::GridRoom, params::AStarPath; - kernel::Int64 = 5, - samples::Int64 = 50) - pmat = zeros(steps(room)) - path, w, _... = Graphs.a_star(room, params) - c = path_density(w, path, kernel) - @inbounds for step in path - pmat[dst(step)] += 1.0 + return d +end + +function diffusion!( + m::Array{Int64}, + g::AbstractGraph{T}, + p::Real, + n::Integer, + terminal::Set{T}, + node_weights::Vector, + initial_infections::Vector{T} + ) where {T} + + # Initialize + infected_vertices = BitSet(initial_infections) + + # Run simulation + for step in 2:n + new_infections = Set{T}() + + @inbounds for i in infected_vertices + outn = outneighbors(g, i) + outd = length(outn) + cur_dis = node_weights[i] + for n in outn + n_dis = node_weights[n] + local_p = cur_dis >= n_dis ? 1.0 : p + if rand() < local_p + push!(new_infections, n) + end + end + end + + # Record only new infections + setdiff!(new_infections, infected_vertices) + for v in new_infections + m[v] += 1 + end + + # Kill of terminal infections + setdiff!(new_infections, terminal) + + # Add new to master set of infected + union!(infected_vertices, new_infections) end - # c::Float64 = 0.0 - # pmat = zeros(steps(room)) - # for _ = 1:samples - # sample = reorganize(room) - # path, w, _... = Graphs.a_star(sample, params) - # c += path_density(w, path, kernel) - # @inbounds for step in path - # pmat[dst(step)] += (1.0 / samples) - # end - # end - # c /= samples - (c, pmat) + + return nothing +end + + +function obstacle_diffusion(room::GridRoom, f::Furniture, + path::Array{T}, + p::Float64, n::Int64) where {T<:Edge} + # diffusion on target furniture + vs = dst.(path) + m = zeros(Int64, steps(room)) + g = pathgraph(clear_room(room)) + clear_gds = gdistances(g, last(vs)) + fs = furniture(room) + terminal = union(fs...) + diffusion!(m, g, p, n, terminal, clear_gds, vs) + # estimate the "cost" incurred by each obstacle + cost_of_f::Float64 = 0.0 + @inbounds for v in f + cost_of_f += m[v] + end + # diffusion across all furniture + # tot = sum(m) + tot::Int64 = 0 + gt_c::Float64 = 0 + @inbounds for fi in fs + f_s = 0 + for v in fi + f_s += m[v] + end + if f_s > cost_of_f + gt_c +=1 + end + tot += f_s + end + frac = iszero(tot) ? 0. : cost_of_f / tot + sm = sum(m) + path_covered = iszero(sm) ? 0. : tot / sm + (cost_of_f, frac, gt_c, tot, Matrix{Float64}(m .> 0.)) +end + +function path_analysis(room::GridRoom, params::PathProcedure, + f::Furniture; + kernel::Int64 = 4, p::Float64 = 0.5, + n::Int64 = 3) + pmat = zeros(steps(room)) + path, w, _... = path_procedure(room, params) + c, fc, mc, sc, m = obstacle_diffusion(room, f, path, p, n) + result = Dict{Symbol, Any}( + :density => path_density(w, path, kernel), + :diffusion_ct => c, + :diffusion_ct_max => mc, + :diffusion_ct_gt => mc, + :diffusion_prop => fc, + :diffusion_tot => sc, + :path_dist => distance_to_path(room, f, path), + :path_length => length(path) + ) + return (m, result) end diff --git a/src/rooms/furniture.jl b/src/rooms/furniture.jl index ce84d63..ea9e51c 100644 --- a/src/rooms/furniture.jl +++ b/src/rooms/furniture.jl @@ -54,12 +54,12 @@ function remove(r::GridRoom, f::Furniture)::GridRoom r.exits, g, d) end -function clear_room(r::GridRoom)::Room +function clear_room(r::GridRoom)::GridRoom g = @> r steps grid PathGraph d = deepcopy(r.data) d[d .== obstacle_tile] .= floor_tile prune_edges!(g, d) - GridGridRoom(r.steps, r.bounds, r.entrance, + GridRoom(r.steps, r.bounds, r.entrance, r.exits, g, d) end diff --git a/src/rooms/viz.jl b/src/rooms/viz.jl index d05d3c2..ec35efc 100644 --- a/src/rooms/viz.jl +++ b/src/rooms/viz.jl @@ -4,8 +4,8 @@ using ImageInTerminal export viz_room -function Base.display(r::GridRoom) - viz_room(r) +function draw_room(r::GridRoom, p::Array{T}) where {T<:Edge} + draw_room(r, map(dst, p)) end function draw_room(r::GridRoom, p::Array{Int64}) @@ -35,3 +35,7 @@ end function viz_room(r::GridRoom) viz_room(r, Int64[]) end + +function Base.display(r::GridRoom) + viz_room(r) +end From 432e97aedeca60e0f8ab20ad65163ffd4a21c8fb Mon Sep 17 00:00:00 2001 From: belledon Date: Sat, 2 Sep 2023 16:00:30 -0400 Subject: [PATCH 06/10] exploring easier stimuli --- scripts/stimuli/generate_rooms.jl | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/scripts/stimuli/generate_rooms.jl b/scripts/stimuli/generate_rooms.jl index c0b1629..cf6367f 100644 --- a/scripts/stimuli/generate_rooms.jl +++ b/scripts/stimuli/generate_rooms.jl @@ -47,7 +47,7 @@ end function build(door_conditions::Vector{GridRoom}, move::Move; - max_f::Int64 = 11, + max_f::Int64 = 9, max_size::Int64 = 5, factor::Int64 = 1, pct_open::Float64 = 0.3, @@ -75,9 +75,8 @@ function build(door_conditions::Vector{GridRoom}, # generate furniture once and then apply to # each door condition with_furn = furniture_gm(rex, vmap, max_f, max_size) - with_furn = expand(with_furn, factor) n_v = prod(steps(with_furn)) - exp_bases = map(r -> add(with_furn, expand(r, factor)), + exp_bases = map(r -> add(with_furn, r), door_conditions) fs = furniture(with_furn) results = DataFrame(door = Int64[], @@ -104,7 +103,7 @@ end function main() - name = "vss_pilot_11f_32x32_restricted" + name = "09_02_2023" dataset_out = "/spaths/datasets/$(name)" isdir(dataset_out) || mkdir(dataset_out) @@ -120,7 +119,7 @@ function main() doors = inds[door_rows, room_dims[2]] # number of trials - n = 30 + n = 6 # will only consider these moves moves = [down_move, up_move] From dffbf01842c4cafb1392c0473b4c9f7747716196 Mon Sep 17 00:00:00 2001 From: belledon Date: Mon, 18 Sep 2023 19:42:42 -0400 Subject: [PATCH 07/10] added wave function collapse --- Manifest.toml | 10 +- Project.toml | 1 + scripts/stimuli/generate_condlist.py | 13 +- scripts/stimuli/generate_rooms.jl | 258 +++++++++++++++------------ scripts/stimuli/render_rooms.jl | 10 +- src/blender/blender.jl | 5 +- src/dgp/path_based/path_cost.jl | 7 +- src/rooms/furniture.jl | 5 + 8 files changed, 178 insertions(+), 131 deletions(-) diff --git a/Manifest.toml b/Manifest.toml index f8bd633..d820eb1 100644 --- a/Manifest.toml +++ b/Manifest.toml @@ -2,7 +2,7 @@ julia_version = "1.8.5" manifest_format = "2.0" -project_hash = "7e39308f2fd25b1f709f686ee7e2b898897a0895" +project_hash = "7a6e5a825cc00237992813307dcbd5c72205c18d" [[deps.AbstractFFTs]] deps = ["ChainRulesCore", "LinearAlgebra"] @@ -1277,6 +1277,14 @@ git-tree-sha1 = "58d6e80b4ee071f5efd07fda82cb9fbe17200868" uuid = "81def892-9a0e-5fdd-b105-ffc91e053289" version = "1.3.0" +[[deps.WaveFunctionCollapse]] +deps = ["Distributions", "DocStringExtensions", "LinearAlgebra", "Random", "Revise", "SparseArrays", "StaticArrays"] +git-tree-sha1 = "911fb459691e1cc13fb1e56b27f2c2dce8e921ce" +repo-rev = "master" +repo-url = "https://github.com/CNCLgithub/WaveFunctionCollapse.jl" +uuid = "bc91b3db-6012-4156-9697-e03a5f4b0c51" +version = "0.1.0" + [[deps.WeakRefStrings]] deps = ["DataAPI", "InlineStrings", "Parsers"] git-tree-sha1 = "b1be2855ed9ed8eac54e5caff2afcdb442d52c23" diff --git a/Project.toml b/Project.toml index c5b76c5..f558071 100644 --- a/Project.toml +++ b/Project.toml @@ -39,3 +39,4 @@ StatProfilerHTML = "a8a75453-ed82-57c9-9e16-4cd1196ecbf5" StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" UnicodePlots = "b8865327-cd53-5732-bb35-84acbb429228" +WaveFunctionCollapse = "bc91b3db-6012-4156-9697-e03a5f4b0c51" diff --git a/scripts/stimuli/generate_condlist.py b/scripts/stimuli/generate_condlist.py index 0b5bcd2..aa72ed7 100755 --- a/scripts/stimuli/generate_condlist.py +++ b/scripts/stimuli/generate_condlist.py @@ -29,12 +29,13 @@ def main(): ab_movies = [] # groupby move for (_, r) in df.iterrows(): - # first create each `a->a` trial - base = f'{r.scene}_{r.door}.png' - aa_movies.append([base, base, r.flipx]) - # then proceed to make `a -> b` trials - move = f'{r.scene}_{r.door}_shifted.png' - ab_movies.append([base, move, r.flipx]) + for door in [1, 2]: + # first create each `a->a` trial + base = f'{r.scene}_{door}.png' + aa_movies.append([base, base, r.flipx]) + # then proceed to make `a -> b` trials + move = f'{r.scene}_{door}_shifted.png' + ab_movies.append([base, move, r.flipx]) # repeate aa trials to have a 50/50 split naa = len(aa_movies) diff --git a/scripts/stimuli/generate_rooms.jl b/scripts/stimuli/generate_rooms.jl index cf6367f..2e17f0a 100644 --- a/scripts/stimuli/generate_rooms.jl +++ b/scripts/stimuli/generate_rooms.jl @@ -1,109 +1,125 @@ using CSV -using Lazy using JSON using DataFrames -using Statistics +using SparseArrays using FunctionalScenes -using LinearAlgebra: norm -using FunctionalCollections - -# using Profile -# using StatProfilerHTML - -function move_change(r::GridRoom, - f::Furniture, - m::Move, - base_og) - shifted = shift_furniture(r,f,m) - shifted_og = occupancy_grid(shifted; sigma = 0., decay = 0.) - # compute impact of shift - d = norm(base_og - shifted_og) -end +using FunctionalScenes: path_cost +using WaveFunctionCollapse + +function prop_weights() + n = length(HT2D_vec) + ws = zeros(n, n) + for (i, hti) = enumerate(HT2D_vec) + ni = count(hti) + for (j, htj) = enumerate(HT2D_vec) + nj = count(htj) + ws[i, j] = ((hti[3] == htj[1]) + (hti[4] == htj[2])) * + ((1+nj)/(1+ni)) + end + end -function paired_change_in_path(x) - # door 1 has no change in path - min_i = argmin(x[:, :d]) - c1 = x[min_i, :door] == 1 && x[min_i, :d] == 0.0 - # door 2 changes - max_i = argmax(x[:, :d]) - c2 = x[max_i, :door] == 2 && x[max_i, :d] < 17.0 && x[max_i, :d] > 13.0 - c1 && c2 + ws .+= 0.1 # adds noise to prop rules + + # ws = gen_prop_rules() + ws[1, :] .+= 0.75 # bump empty hyper tile + ws[2:end, 1] .+= 0.25 # + ws[end, 1] += 0.25 # + return ws end -function examine_furniture(df::DataFrame)::DataFrame - gdf = @>> DataFrames.groupby(df, :furniture) begin - # look find change for one but not another door - filter(paired_change_in_path) - end - isempty(gdf) && return DataFrame() - # pick furniture, move pair with biggest difference - selected_i = @> gdf begin - combine(:d => maximum) - sortperm(:d_maximum) - last +function room_to_template(r::GridRoom; + gap::Int64 = 2) + d = data(r) + walls = d .== wall_tile + y, x = size(d) + r, c = Int64(y / 2), Int64(x / 2) + result = Matrix{Int64}(undef, r, c) + for ir = 1:r, ic = 1:c + row_start = (ir - 1) * 2 + 1 + row_end = ir * 2 + col_start = (ic - 1) * 2 + 1 + col_end = ic * 2 + cell = walls[row_start:row_end, col_start:col_end] + result[ir, ic] = WaveFunctionCollapse._ht2_hash_map[cell] end - gdf[selected_i] + gap_rng = (gap+1):(r-gap) + result[gap_rng, gap_rng] .= 0 + return sparse(result) +end + +function empty_room(steps, bounds, entrance, exits) + r = GridRoom(steps, bounds, entrance, exits) + m = data(r) + m[minimum(entrance) - 1 : maximum(entrance) + 1] .= floor_tile + GridRoom(r, m) +end + +function sample_obstacles(template::AbstractMatrix{Int64}, + pr::Matrix{Float64}) + ws = WaveState(template, pr) + collapse!(ws, pr) + # empty out original walls + ws.wave[template .!= 0] .= 1 + expanded = WaveFunctionCollapse.expand(ws) + Set{Int64}(findall(vec(expanded))) end -function build(door_conditions::Vector{GridRoom}, - move::Move; - max_f::Int64 = 9, - max_size::Int64 = 5, - factor::Int64 = 1, - pct_open::Float64 = 0.3, - side_buffer::Int64 = 1) - - # assuming all rooms have the same entrance and dimensions - rex = first(door_conditions) - # rex = expand(first(door_conditions), factor) - dims = steps(rex) - - # prevent furniture generated in either: - # -1 out of sight - # -2 blocking entrance exit - # -3 hard to detect spaces next to walls - weights = Matrix{Bool}(zeros(dims)) - # ensures that there is no furniture near the observer - start_x = Int64(ceil(last(dims) * pct_open)) - stop_x = last(dims) - 2 # nor blocking the exit - # buffer along sides - start_y = side_buffer + 1 - stop_y = first(dims) - side_buffer - weights[start_y:stop_y, start_x:stop_x] .= 1.0 - vmap = PersistentVector(vec(weights)) +function sample_pair(left_room::GridRoom, + right_room::GridRoom, + template::AbstractMatrix{Int64}, + pws::Matrix{Float64}) + + obstacles = sample_obstacles(template, pws) # generate furniture once and then apply to # each door condition - with_furn = furniture_gm(rex, vmap, max_f, max_size) - n_v = prod(steps(with_furn)) - exp_bases = map(r -> add(with_furn, r), - door_conditions) - fs = furniture(with_furn) - results = DataFrame(door = Int64[], - furniture = Int64[], - move = Symbol[], - d = Float64[]) - for (i, ri) in enumerate(exp_bases) - base_og = occupancy_grid(ri; sigma = 0., decay = 0.) - for (j, fj) in enumerate(fs) - # REVIEW: see if only changing rear obstacles makes a difference - # ignore obstacles in the front - (minimum(fj) < (0.3 * n_v)) && continue - valid_move(ri, fj, move) || continue - d = move_change(ri, fj, move, base_og) - # door, furn, distance - push!(results, [i, j, move, d]) - end + left = add(left_room, obstacles) + right = add(right_room, obstacles) + + (left, right) + +end + +function analyze_path(room::GridRoom, params::PathProcedure) + path, _, _, dm = path_procedure(room, params) + path_cost(path, dm) +end + +function eval_pair(left_door::GridRoom, right_door::GridRoom, + move::Move, + path_params::PathProcedure) + + # initial paths + initial_left_pc = analyze_path(left_door, path_params) + initial_right_pc = analyze_path(right_door, path_params) + + # jitter each furniture + # consider as candidate if: + # 1. move does not change left path + # 2. move changes right path + fs = furniture(left_door) + candidates = falses(length(fs)) + for (fi, f) in enumerate(fs) + length(f) > 3 && continue + # shifted_left = shift_furniture(left_door, f, move) + shifted_left = remove(left_door, f) + shifted_left_pc = analyze_path(shifted_left, path_params) + abs(initial_left_pc - shifted_left_pc) > 0.1 && continue + # shifted_right = shift_furniture(right_door, f, move) + shifted_right = remove(right_door, f) + shifted_right_pc = analyze_path(shifted_right, path_params) + (initial_right_pc - shifted_right_pc) < 2.5 && continue + candidates[fi] = true end - # see if any furniture pieces fit the criterion - results = examine_furniture(results) - (exp_bases, results) + + # pick a random candidate + any(candidates) ? rand(findall(candidates)) : 0 end function main() - name = "09_02_2023" + name = "09_18_2023" dataset_out = "/spaths/datasets/$(name)" isdir(dataset_out) || mkdir(dataset_out) @@ -112,14 +128,20 @@ function main() # Parameters - room_dims = (16, 16) + room_steps = (16, 16) + room_bounds = (32., 32.) entrance = [8, 9] door_rows = [5, 12] - inds = LinearIndices(room_dims) - doors = inds[door_rows, room_dims[2]] + inds = LinearIndices(room_steps) + doors = inds[door_rows, room_steps[2]] + + # path_params = AStarPath(obstacle_cost=1.0) + path_params = NoisyPath(;obstacle_cost=2.0, + kernel_sigma = 0.5, + kernel_width = 3) # number of trials - n = 6 + n = 10 # will only consider these moves moves = [down_move, up_move] @@ -128,41 +150,53 @@ function main() # number of trials per move condition max_count = Int64(ceil(n / n_moves)) - # empty rooms with doors - templates = @>> doors begin - map(d -> GridRoom(room_dims, room_dims, entrance, [d])) - collect(GridRoom) - end + # empty room with doors + left_cond = empty_room(room_steps, room_bounds, entrance, [doors[1]]) + right_cond = empty_room(room_steps, room_bounds, entrance, [doors[2]]) + template = room_to_template(left_cond) + pws = prop_weights() + + display(pws) + display(template) # will store summary of generated rooms here - df = DataFrame(id = Int64[], - flip = Bool[], - door = Int64[], + df = DataFrame(scene = Int64[], + flipx = Bool[], furniture = Int64[], - move = Symbol[], - d = Float64[]) + move = Symbol[]) + for (idx, move) in enumerate(moves) i = 1 while i <= max_count # generate a room pair - (pair, _df) = build(templates, move, factor = 2) + (left, right) = sample_pair(left_cond, right_cond, template, pws) + fi = eval_pair(left, right, move, path_params) # no valid pair generated, try again or finish - isempty(_df) && continue + fi == 0 && continue # valid pair found, organize and store id = (idx - 1) * max_count + i - _df[!, :id] .= id - _df[!, :flip] .= (i-1) % 2 - append!(df, _df) - + toflip = (i-1) % 2 + push!(df, [id, toflip, fi, move]) + + right_path, _... = path_procedure(right, path_params) + viz_room(right, right_path) + # shifted_right = shift_furniture(right, fi, move) + shifted_right = remove(right, furniture(right)[fi]) + shifted_right_path, _... = path_procedure(shifted_right, path_params) + viz_room(shifted_right, shifted_right_path) + left_path, _... = path_procedure(left, path_params) + viz_room(left, left_path) + # shifted_left = shift_furniture(left, fi, move) + shifted_left = remove(left, furniture(left)[fi]) + shifted_left_path, _... = path_procedure(shifted_left, path_params) + viz_room(shifted_left, shifted_left_path) # save scenes as json open("$(scenes_out)/$(id)_1.json", "w") do f - _d = pair[1] |> json - write(f, _d) + write(f, left |> json) end open("$(scenes_out)/$(id)_2.json", "w") do f - _d = pair[2] |> json - write(f, _d) + write(f, right |> json) end print("move $(idx): $(i)/$(max_count)\r") @@ -173,8 +207,6 @@ function main() # saving summary / manifest CSV.write("$(scenes_out).csv", df) - # saving rooms - return nothing end diff --git a/scripts/stimuli/render_rooms.jl b/scripts/stimuli/render_rooms.jl index 50a5fbe..ce87ba4 100644 --- a/scripts/stimuli/render_rooms.jl +++ b/scripts/stimuli/render_rooms.jl @@ -17,27 +17,27 @@ function render_stims(df::DataFrame, name::String; threads = Sys.CPU_THREADS) out = "/spaths/datasets/$(name)/render_cycles" isdir(out) || mkdir(out) - for r in eachrow(df) - base_p = "/spaths/datasets/$(name)/scenes/$(r.scene)_$(r.door).json" + for r in eachrow(df), door = 1:2 + base_p = "/spaths/datasets/$(name)/scenes/$(r.scene)_$(door).json" local base_s open(base_p, "r") do f base_s = JSON.parse(f) end base = from_json(GridRoom, base_s) - p = "$(out)/$(r.scene)_$(r.door)" + p = "$(out)/$(r.scene)_$(door)" render(base, p; cycles_args...) room = shift_furniture(base, furniture(base)[r.furniture], Symbol(r.move)) - p = "$(out)/$(r.scene)_$(r.door)_shifted" + p = "$(out)/$(r.scene)_$(door)_shifted" render(room, p; cycles_args...) end end function main() - cmd = ["pathcost_6.0", "0"] + cmd = ["09_02_2023", "0"] args = parse_commandline(;x=cmd) name = args["dataset"] diff --git a/src/blender/blender.jl b/src/blender/blender.jl index 0ca3a88..8f47f93 100644 --- a/src/blender/blender.jl +++ b/src/blender/blender.jl @@ -23,11 +23,10 @@ function camera(r::Room) pos = transform.(Tuple.(cis[entrance(r)])) # REVIEW: may need adjustment along y (forward-back) # NOTE: push back slightly to maximize visability of scene - y = pos[1][2] - 1.75 * space[2] - x = mean(first.(pos)) + 0.5 + y = pos[1][2] - 2.25 * space[2] # center of x-y for entrances camera_height = 0.75 * tile_height - pos = [x, y, camera_height] + pos = [0., y, camera_height] orientation = [0.475 * pi, 0., 0.] Dict(:position => pos, :orientation => orientation) diff --git a/src/dgp/path_based/path_cost.jl b/src/dgp/path_based/path_cost.jl index 0d814ab..9acca24 100644 --- a/src/dgp/path_based/path_cost.jl +++ b/src/dgp/path_based/path_cost.jl @@ -2,7 +2,7 @@ using ImageFiltering using Random export PathProcedure, AStarPath, NoisyPath, path_analysis, - path_density, distance_to_path + path_density, distance_to_path, path_procedure abstract type PathProcedure end @@ -61,9 +61,10 @@ function nav_graph(r::GridRoom, params::NoisyPath, sigma::Float64) d = data(r) ws = fill(floor_cost, size(d)) ws[d .== obstacle_tile] .= obstacle_cost - ws[d .== wall_tile] .= obstacle_cost + # ws[d .== wall_tile] .= obstacle_cost noisy_ws = imfilter(ws, Kernel.gaussian([sigma, sigma], [kernel_width, kernel_width])) + noisy_ws[d .== obstacle_tile] .= obstacle_cost noisy_ws[d .== wall_tile] .= wall_cost n = length(d) @@ -75,7 +76,7 @@ function nav_graph(r::GridRoom, params::NoisyPath, sigma::Float64) delta = abs(i - j) delta == 1 || delta == row || continue adm[i, j] = adm[j, i] = true - dsm[i, j] = dsm[j, i] = noisy_ws[i] + noisy_ws[j] + dsm[i, j] = dsm[j, i] = noisy_ws[i] + noisy_ws[j] + 1.0 end (noisy_ws, adm, dsm) end diff --git a/src/rooms/furniture.jl b/src/rooms/furniture.jl index ea9e51c..f8f750e 100644 --- a/src/rooms/furniture.jl +++ b/src/rooms/furniture.jl @@ -84,6 +84,11 @@ function valid_moves(r::GridRoom, f::Furniture)::BitVector BitVector(moves) end +function shift_furniture(r::GridRoom, i::Int64, m::Move) + f = furniture(r)[i] + shift_furniture(r, f, m) +end + function shift_furniture(r::GridRoom, f::Furniture, m::Symbol) shift_furniture(r, f, move_d[m]) end From 2eb070a17e89f364beb63c238731bb75ef24f10c Mon Sep 17 00:00:00 2001 From: belledon Date: Tue, 19 Sep 2023 09:55:05 -0400 Subject: [PATCH 08/10] dataset option 1 ckpt --- scripts/stimuli/generate_rooms.jl | 94 +++++++++++++------------------ scripts/stimuli/render_rooms.jl | 10 ++-- 2 files changed, 44 insertions(+), 60 deletions(-) diff --git a/scripts/stimuli/generate_rooms.jl b/scripts/stimuli/generate_rooms.jl index 2e17f0a..d75b1f4 100644 --- a/scripts/stimuli/generate_rooms.jl +++ b/scripts/stimuli/generate_rooms.jl @@ -18,12 +18,12 @@ function prop_weights() end end - ws .+= 0.1 # adds noise to prop rules + ws .+= 0.05 # adds noise to prop rules # ws = gen_prop_rules() ws[1, :] .+= 0.75 # bump empty hyper tile - ws[2:end, 1] .+= 0.25 # - ws[end, 1] += 0.25 # + ws[2:end, 1] .+= 0.1 # + ws[end, 1] += 0.2 # return ws end @@ -86,7 +86,6 @@ function analyze_path(room::GridRoom, params::PathProcedure) end function eval_pair(left_door::GridRoom, right_door::GridRoom, - move::Move, path_params::PathProcedure) # initial paths @@ -101,14 +100,12 @@ function eval_pair(left_door::GridRoom, right_door::GridRoom, candidates = falses(length(fs)) for (fi, f) in enumerate(fs) length(f) > 3 && continue - # shifted_left = shift_furniture(left_door, f, move) shifted_left = remove(left_door, f) shifted_left_pc = analyze_path(shifted_left, path_params) abs(initial_left_pc - shifted_left_pc) > 0.1 && continue - # shifted_right = shift_furniture(right_door, f, move) shifted_right = remove(right_door, f) shifted_right_pc = analyze_path(shifted_right, path_params) - (initial_right_pc - shifted_right_pc) < 2.5 && continue + (initial_right_pc - shifted_right_pc) < 3.5 && continue candidates[fi] = true end @@ -141,14 +138,7 @@ function main() kernel_width = 3) # number of trials - n = 10 - - # will only consider these moves - moves = [down_move, up_move] - n_moves = length(moves) - - # number of trials per move condition - max_count = Int64(ceil(n / n_moves)) + n = 20 # empty room with doors left_cond = empty_room(room_steps, room_bounds, entrance, [doors[1]]) @@ -162,46 +152,42 @@ function main() # will store summary of generated rooms here df = DataFrame(scene = Int64[], flipx = Bool[], - furniture = Int64[], - move = Symbol[]) - - for (idx, move) in enumerate(moves) - i = 1 - while i <= max_count - # generate a room pair - (left, right) = sample_pair(left_cond, right_cond, template, pws) - fi = eval_pair(left, right, move, path_params) - # no valid pair generated, try again or finish - fi == 0 && continue - - # valid pair found, organize and store - id = (idx - 1) * max_count + i - toflip = (i-1) % 2 - push!(df, [id, toflip, fi, move]) - - right_path, _... = path_procedure(right, path_params) - viz_room(right, right_path) - # shifted_right = shift_furniture(right, fi, move) - shifted_right = remove(right, furniture(right)[fi]) - shifted_right_path, _... = path_procedure(shifted_right, path_params) - viz_room(shifted_right, shifted_right_path) - left_path, _... = path_procedure(left, path_params) - viz_room(left, left_path) - # shifted_left = shift_furniture(left, fi, move) - shifted_left = remove(left, furniture(left)[fi]) - shifted_left_path, _... = path_procedure(shifted_left, path_params) - viz_room(shifted_left, shifted_left_path) - # save scenes as json - open("$(scenes_out)/$(id)_1.json", "w") do f - write(f, left |> json) - end - open("$(scenes_out)/$(id)_2.json", "w") do f - write(f, right |> json) - end - - print("move $(idx): $(i)/$(max_count)\r") - i += 1 + furniture = Int64[]) + + i = 1 + while i <= n + # generate a room pair + (left, right) = sample_pair(left_cond, right_cond, template, pws) + fi = eval_pair(left, right, path_params) + # no valid pair generated, try again or finish + fi == 0 && continue + + # valid pair found, organize and store + toflip = (i-1) % 2 + push!(df, [i, toflip, fi]) + + right_path, _... = path_procedure(right, path_params) + viz_room(right, right_path) + # shifted_right = shift_furniture(right, fi, move) + shifted_right = remove(right, furniture(right)[fi]) + shifted_right_path, _... = path_procedure(shifted_right, path_params) + viz_room(shifted_right, shifted_right_path) + left_path, _... = path_procedure(left, path_params) + viz_room(left, left_path) + # shifted_left = shift_furniture(left, fi, move) + shifted_left = remove(left, furniture(left)[fi]) + shifted_left_path, _... = path_procedure(shifted_left, path_params) + viz_room(shifted_left, shifted_left_path) + # save scenes as json + open("$(scenes_out)/$(i)_1.json", "w") do f + write(f, left |> json) end + open("$(scenes_out)/$(i)_2.json", "w") do f + write(f, right |> json) + end + + print("scene $(i)/$(n)\r") + i += 1 end @show df # saving summary / manifest diff --git a/scripts/stimuli/render_rooms.jl b/scripts/stimuli/render_rooms.jl index ce87ba4..0c0715e 100644 --- a/scripts/stimuli/render_rooms.jl +++ b/scripts/stimuli/render_rooms.jl @@ -1,5 +1,4 @@ using CSV -using Lazy using JSON using FileIO using ArgParse @@ -27,17 +26,16 @@ function render_stims(df::DataFrame, name::String; p = "$(out)/$(r.scene)_$(door)" render(base, p; cycles_args...) - room = shift_furniture(base, - furniture(base)[r.furniture], - Symbol(r.move)) - p = "$(out)/$(r.scene)_$(door)_shifted" + room = remove(base, + furniture(base)[r.furniture]) + p = "$(out)/$(r.scene)_$(door)_removed" render(room, p; cycles_args...) end end function main() - cmd = ["09_02_2023", "0"] + cmd = ["09_18_2023", "0"] args = parse_commandline(;x=cmd) name = args["dataset"] From d1cbae4b25bd2eefe93f2426955ec5c77637cc46 Mon Sep 17 00:00:00 2001 From: belledon Date: Fri, 22 Sep 2023 09:47:30 -0400 Subject: [PATCH 09/10] wfc checkpoint --- Manifest.toml | 422 +++++++++++++++------------ scripts/stimuli/generate_condlist.py | 2 +- scripts/stimuli/generate_rooms.jl | 68 ++--- scripts/stimuli/render_rooms.jl | 8 +- src/dgp/path_based/path_cost.jl | 29 +- src/rooms/furniture.jl | 9 + 6 files changed, 299 insertions(+), 239 deletions(-) diff --git a/Manifest.toml b/Manifest.toml index d820eb1..7703882 100644 --- a/Manifest.toml +++ b/Manifest.toml @@ -5,10 +5,10 @@ manifest_format = "2.0" project_hash = "7a6e5a825cc00237992813307dcbd5c72205c18d" [[deps.AbstractFFTs]] -deps = ["ChainRulesCore", "LinearAlgebra"] -git-tree-sha1 = "69f7020bd72f069c219b5e8c236c1fa90d2cb409" +deps = ["ChainRulesCore", "LinearAlgebra", "Test"] +git-tree-sha1 = "d92ad398961a3ed262d8bf04a1a2b8340f915fef" uuid = "621f4979-c628-5d54-868e-fcf4e3e8185c" -version = "1.2.1" +version = "1.5.0" [[deps.AbstractTrees]] git-tree-sha1 = "03e0550477d86222521d254b741d470ba17ea0b5" @@ -16,10 +16,10 @@ uuid = "1520ce14-60c1-5f80-bbc7-55ef81b5835c" version = "0.3.4" [[deps.Adapt]] -deps = ["LinearAlgebra"] -git-tree-sha1 = "0310e08cb19f5da31d08341c6120c047598f5b9c" +deps = ["LinearAlgebra", "Requires"] +git-tree-sha1 = "76289dc51920fdc6e0013c872ba9551d54961c24" uuid = "79e6a3ab-5dfb-504d-930d-738a2a938a0e" -version = "3.5.0" +version = "3.6.2" [[deps.ArgParse]] deps = ["Logging", "TextWrap"] @@ -40,6 +40,12 @@ version = "0.2.0" [[deps.Artifacts]] uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33" +[[deps.Atomix]] +deps = ["UnsafeAtomics"] +git-tree-sha1 = "c06a868224ecba914baa6942988e2f2aade419be" +uuid = "a9b6321e-bd34-4604-b9c9-b65b8de01458" +version = "0.1.0" + [[deps.AxisAlgorithms]] deps = ["LinearAlgebra", "Random", "SparseArrays", "WoodburyMatrices"] git-tree-sha1 = "66771c8d21c8ff5e3a93379480a2307ac36863f7" @@ -48,9 +54,9 @@ version = "1.0.1" [[deps.AxisArrays]] deps = ["Dates", "IntervalSets", "IterTools", "RangeArrays"] -git-tree-sha1 = "1dd4d9f5beebac0c03446918741b1a03dc5e5788" +git-tree-sha1 = "16351be62963a67ac4083f748fdb3cca58bfd52f" uuid = "39de3d68-74b9-583c-8d2d-e117c070f3a9" -version = "0.4.6" +version = "0.4.7" [[deps.Base64]] uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" @@ -92,45 +98,45 @@ version = "0.2.2" [[deps.ChainRulesCore]] deps = ["Compat", "LinearAlgebra", "SparseArrays"] -git-tree-sha1 = "c6d890a52d2c4d55d326439580c3b8d0875a77d9" +git-tree-sha1 = "e30f2f4e20f7f186dc36529910beaedc60cfa644" uuid = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" -version = "1.15.7" +version = "1.16.0" [[deps.ChangesOfVariables]] -deps = ["ChainRulesCore", "LinearAlgebra", "Test"] -git-tree-sha1 = "485193efd2176b88e6622a39a246f8c5b600e74e" +deps = ["InverseFunctions", "LinearAlgebra", "Test"] +git-tree-sha1 = "2fba81a302a7be671aefe194f0525ef231104e7f" uuid = "9e997f8a-9a97-42d5-a9f1-ce6bfc15e2c0" -version = "0.1.6" +version = "0.1.8" [[deps.Clustering]] deps = ["Distances", "LinearAlgebra", "NearestNeighbors", "Printf", "Random", "SparseArrays", "Statistics", "StatsBase"] -git-tree-sha1 = "64df3da1d2a26f4de23871cd1b6482bb68092bd5" +git-tree-sha1 = "42fe66dbc8f1d09a44aa87f18d26926d06a35f84" uuid = "aaaa29a8-35af-508c-8bc3-b662a17a0fe5" -version = "0.14.3" +version = "0.15.3" [[deps.CodeTracking]] deps = ["InteractiveUtils", "UUIDs"] -git-tree-sha1 = "0e5c14c3bb8a61b3d53b2c0620570c332c8d0663" +git-tree-sha1 = "a1296f0fe01a4c3f9bf0dc2934efbf4416f5db31" uuid = "da1fd8a2-8d9e-5ec2-8556-3022fb5608a2" -version = "1.2.0" +version = "1.3.4" [[deps.CodecBzip2]] deps = ["Bzip2_jll", "Libdl", "TranscodingStreams"] -git-tree-sha1 = "2e62a725210ce3c3c2e1a3080190e7ca491f18d7" +git-tree-sha1 = "ad41de3795924f7a056243eb3e4161448f0523e6" uuid = "523fee87-0ab8-5b00-afb7-3ecf72e48cfd" -version = "0.7.2" +version = "0.8.0" [[deps.CodecZlib]] deps = ["TranscodingStreams", "Zlib_jll"] -git-tree-sha1 = "9c209fb7536406834aa938fb149964b985de6c83" +git-tree-sha1 = "02aa26a4cf76381be7f66e020a3eddeb27b0a092" uuid = "944b1d66-785c-5afd-91f1-9de20f533193" -version = "0.7.1" +version = "0.7.2" [[deps.ColorSchemes]] -deps = ["ColorTypes", "ColorVectorSpace", "Colors", "FixedPointNumbers", "Random", "SnoopPrecompile"] -git-tree-sha1 = "aa3edc8f8dea6cbfa176ee12f7c2fc82f0608ed3" +deps = ["ColorTypes", "ColorVectorSpace", "Colors", "FixedPointNumbers", "PrecompileTools", "Random"] +git-tree-sha1 = "67c1f244b991cad9b0aa4b7540fb758c2488b129" uuid = "35d6a980-a343-548e-a6ea-1d62b119f2f4" -version = "3.20.0" +version = "3.24.0" [[deps.ColorTypes]] deps = ["FixedPointNumbers", "Random"] @@ -158,9 +164,9 @@ version = "0.3.0" [[deps.Compat]] deps = ["Dates", "LinearAlgebra", "UUIDs"] -git-tree-sha1 = "61fdd77467a5c3ad071ef8277ac6bd6af7dd4c04" +git-tree-sha1 = "e460f044ca8b99be31d35fe54fc33a5c33dd8ed7" uuid = "34da2185-b29b-5c13-b0c7-acf172513d20" -version = "4.6.0" +version = "4.9.0" [[deps.CompilerSupportLibraries_jll]] deps = ["Artifacts", "Libdl"] @@ -174,15 +180,15 @@ version = "0.3.2" [[deps.Conda]] deps = ["Downloads", "JSON", "VersionParsing"] -git-tree-sha1 = "e32a90da027ca45d84678b826fffd3110bb3fc90" +git-tree-sha1 = "8c86e48c0db1564a1d49548d3515ced5d604c408" uuid = "8f4d0f93-b110-5947-807f-2305c1781a2d" -version = "1.8.0" +version = "1.9.1" [[deps.ConstructionBase]] deps = ["LinearAlgebra"] -git-tree-sha1 = "89a9db8d28102b094992472d333674bd1a83ce2a" +git-tree-sha1 = "c53fc348ca4d40d7b371e71fd52251839080cbc9" uuid = "187b0558-2788-49d3-abe0-74a17ed4e7c9" -version = "1.5.1" +version = "1.5.4" [[deps.Contour]] git-tree-sha1 = "d05d9e7b7aedff4e5b51a029dced05cfb6125781" @@ -191,9 +197,9 @@ version = "0.6.2" [[deps.CoordinateTransformations]] deps = ["LinearAlgebra", "StaticArrays"] -git-tree-sha1 = "681ea870b918e7cff7111da58791d7f718067a19" +git-tree-sha1 = "f9d7112bfff8a19a3a4ea4e03a8e6a91fe8456bf" uuid = "150eb455-5306-5404-9cee-2592286d6298" -version = "0.6.2" +version = "0.6.3" [[deps.Crayons]] git-tree-sha1 = "249fe38abf76d48563e2f4556bebd215aa317e15" @@ -206,9 +212,9 @@ uuid = "dc8bdbbb-1ca9-579f-8c36-e416f6a65cce" version = "1.0.2" [[deps.DataAPI]] -git-tree-sha1 = "e8119c1a33d267e16108be441a287a6981ba1630" +git-tree-sha1 = "8da84edb865b0b5b0100c0666a9bc9a0b71c553c" uuid = "9a962f9c-6df0-11e9-0e5d-c546b8b5ee8a" -version = "1.14.0" +version = "1.15.0" [[deps.DataFrames]] deps = ["Compat", "DataAPI", "Future", "InlineStrings", "InvertedIndices", "IteratorInterfaceExtensions", "LinearAlgebra", "Markdown", "Missings", "PooledArrays", "PrettyTables", "Printf", "REPL", "Random", "Reexport", "SentinelArrays", "SnoopPrecompile", "SortingAlgorithms", "Statistics", "TableTraits", "Tables", "Unicode"] @@ -245,9 +251,9 @@ version = "1.1.0" [[deps.DiffRules]] deps = ["IrrationalConstants", "LogExpFunctions", "NaNMath", "Random", "SpecialFunctions"] -git-tree-sha1 = "a4ad7ef19d2cdc2eff57abbbe68032b1cd0bd8f8" +git-tree-sha1 = "23163d55f885173722d1e4cf0f6110cdbaf7e272" uuid = "b552c78f-8df3-52c6-915a-8e097449b14b" -version = "1.13.0" +version = "1.15.1" [[deps.Distances]] deps = ["LinearAlgebra", "SparseArrays", "Statistics", "StatsAPI"] @@ -290,9 +296,9 @@ version = "2.2.4+0" [[deps.ExactOptimalTransport]] deps = ["Distances", "Distributions", "FillArrays", "LinearAlgebra", "MathOptInterface", "PDMats", "QuadGK", "SparseArrays", "StatsBase"] -git-tree-sha1 = "abf7262468e90e71ca51289c4fcff91e0a919db5" +git-tree-sha1 = "aca11e5cbf419be6778707f4ddc90d486bc79e92" uuid = "24df6009-d856-477c-ac5c-91f668376b31" -version = "0.2.3" +version = "0.2.5" [[deps.Extents]] git-tree-sha1 = "5e1e4c53fa39afe63a7d356e30452249365fba99" @@ -307,9 +313,9 @@ version = "0.3.2" [[deps.FFTW]] deps = ["AbstractFFTs", "FFTW_jll", "LinearAlgebra", "MKL_jll", "Preferences", "Reexport"] -git-tree-sha1 = "90630efff0894f8142308e334473eba54c433549" +git-tree-sha1 = "b4fbdd20c889804969571cc589900803edda16b7" uuid = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341" -version = "1.5.0" +version = "1.7.1" [[deps.FFTW_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] @@ -334,9 +340,9 @@ uuid = "7b1f6079-737a-58dc-b8bc-7a2ca5c1b5ee" [[deps.FillArrays]] deps = ["LinearAlgebra", "Random", "SparseArrays", "Statistics"] -git-tree-sha1 = "d3ba08ab64bdfd27234d3f61956c966266757fe6" +git-tree-sha1 = "7072f1e3e5a8be51d525d64f63d3ec1287ff2790" uuid = "1a297f60-69ca-5386-bcde-b61e274b549b" -version = "0.13.7" +version = "0.13.11" [[deps.FixedPointNumbers]] deps = ["Statistics"] @@ -350,17 +356,11 @@ git-tree-sha1 = "d9eee53657f6a13ee51120337f98684c9c702264" uuid = "08572546-2f56-4bcf-ba4e-bab62c3a3f89" version = "0.2.10" -[[deps.Formatting]] -deps = ["Printf"] -git-tree-sha1 = "8339d61043228fdd3eb658d86c926cb282ae72a8" -uuid = "59287772-0a20-5a39-b81b-1366585eb4c0" -version = "0.4.2" - [[deps.ForwardDiff]] deps = ["CommonSubexpressions", "DiffResults", "DiffRules", "LinearAlgebra", "LogExpFunctions", "NaNMath", "Preferences", "Printf", "Random", "SpecialFunctions", "StaticArrays"] -git-tree-sha1 = "a69dd6db8a809f78846ff259298678f0d6212180" +git-tree-sha1 = "cf0fe81336da9fb90944683b8c41984b08793dad" uuid = "f6369f11-7733-5829-9624-2563aa707210" -version = "0.10.34" +version = "0.10.36" [[deps.FunctionWrappers]] git-tree-sha1 = "d62485945ce5ae9c0c48f124a84998d755bae00e" @@ -379,9 +379,9 @@ uuid = "9fa8497b-333b-5362-9e8d-4d0656e87820" [[deps.GPUArraysCore]] deps = ["Adapt"] -git-tree-sha1 = "1cd7f0af1aa58abc02ea1d872953a97359cb87fa" +git-tree-sha1 = "2d6ca471a6c7b536127afccfa7564b5b39227fe0" uuid = "46192b85-c4d5-4398-a991-12ede77f4527" -version = "0.1.4" +version = "0.1.5" [[deps.Gen]] deps = ["Compat", "DataStructures", "Distributions", "ForwardDiff", "FunctionalCollections", "JSON", "LinearAlgebra", "MacroTools", "Parameters", "Random", "ReverseDiff", "SpecialFunctions"] @@ -399,15 +399,15 @@ version = "1.0.0" [[deps.GeoInterface]] deps = ["Extents"] -git-tree-sha1 = "e07a1b98ed72e3cdd02c6ceaab94b8a606faca40" +git-tree-sha1 = "bb198ff907228523f3dee1070ceee63b9359b6ab" uuid = "cf35fbd7-0cd7-5166-be24-54bfbe79505f" -version = "1.2.1" +version = "1.3.1" [[deps.GeometryBasics]] -deps = ["EarCut_jll", "GeoInterface", "IterTools", "LinearAlgebra", "StaticArrays", "StructArrays", "Tables"] -git-tree-sha1 = "fe9aea4ed3ec6afdfbeb5a4f39a2208909b162a6" +deps = ["EarCut_jll", "Extents", "GeoInterface", "IterTools", "LinearAlgebra", "StaticArrays", "StructArrays", "Tables"] +git-tree-sha1 = "424a5a6ce7c5d97cca7bcc4eac551b97294c54af" uuid = "5c1252a2-5f33-56bf-86c9-59e7332b4326" -version = "0.4.5" +version = "0.4.9" [[deps.GeometryTypes]] deps = ["ColorTypes", "FixedPointNumbers", "LinearAlgebra", "StaticArrays"] @@ -440,16 +440,16 @@ uuid = "0bc81568-2411-4001-9bf1-c899fa54f385" version = "0.3.5" [[deps.HypergeometricFunctions]] -deps = ["DualNumbers", "LinearAlgebra", "OpenLibm_jll", "SpecialFunctions", "Test"] -git-tree-sha1 = "709d864e3ed6e3545230601f94e11ebc65994641" +deps = ["DualNumbers", "LinearAlgebra", "OpenLibm_jll", "SpecialFunctions"] +git-tree-sha1 = "f218fe3736ddf977e0e772bc9a586b2383da2685" uuid = "34004b35-14d8-5ef3-9330-4cdb6864b03a" -version = "0.3.11" +version = "0.3.23" [[deps.ImageAxes]] deps = ["AxisArrays", "ImageBase", "ImageCore", "Reexport", "SimpleTraits"] -git-tree-sha1 = "c54b581a83008dc7f292e205f4c409ab5caa0f04" +git-tree-sha1 = "2e4520d67b0cef90865b3ef727594d2a58e0e1f8" uuid = "2803e5a7-5153-5ecf-9a86-9b4c37f5f5ac" -version = "0.6.10" +version = "0.6.11" [[deps.ImageBase]] deps = ["ImageCore", "Reexport"] @@ -458,10 +458,10 @@ uuid = "c817782e-172a-44cc-b673-b171935fbb9e" version = "0.1.5" [[deps.ImageContrastAdjustment]] -deps = ["ImageCore", "ImageTransformations", "Parameters"] -git-tree-sha1 = "0d75cafa80cf22026cea21a8e6cf965295003edc" +deps = ["ImageBase", "ImageCore", "ImageTransformations", "Parameters"] +git-tree-sha1 = "eb3d4365a10e3f3ecb3b115e9d12db131d28a386" uuid = "f332f351-ec65-5f6a-b3d1-319c6670881a" -version = "0.3.10" +version = "0.3.12" [[deps.ImageCore]] deps = ["AbstractFFTs", "ColorVectorSpace", "Colors", "FixedPointNumbers", "Graphics", "MappedArrays", "MosaicViews", "OffsetArrays", "PaddedViews", "Reexport"] @@ -471,9 +471,9 @@ version = "0.9.4" [[deps.ImageDistances]] deps = ["Distances", "ImageCore", "ImageMorphology", "LinearAlgebra", "Statistics"] -git-tree-sha1 = "b1798a4a6b9aafb530f8f0c4a7b2eb5501e2f2a3" +git-tree-sha1 = "08b0e6354b21ef5dd5e49026028e41831401aca8" uuid = "51556ac3-7006-55f5-8cb3-34580c88182d" -version = "0.2.16" +version = "0.2.17" [[deps.ImageFiltering]] deps = ["CatIndices", "ComputationalResources", "DataStructures", "FFTViews", "FFTW", "ImageBase", "ImageCore", "LinearAlgebra", "OffsetArrays", "Reexport", "SnoopPrecompile", "SparseArrays", "StaticArrays", "Statistics", "TiledIteration"] @@ -483,9 +483,9 @@ version = "0.7.3" [[deps.ImageIO]] deps = ["FileIO", "IndirectArrays", "JpegTurbo", "LazyModules", "Netpbm", "OpenEXR", "PNGFiles", "QOI", "Sixel", "TiffImages", "UUIDs"] -git-tree-sha1 = "342f789fd041a55166764c351da1710db97ce0e0" +git-tree-sha1 = "bca20b2f5d00c4fbc192c3212da8fa79f4688009" uuid = "82e4d734-157c-48bb-816b-45c225c6df19" -version = "0.6.6" +version = "0.6.7" [[deps.ImageInTerminal]] deps = ["ColorTypes", "Crayons", "FileIO", "Sixel", "XTermColors"] @@ -507,9 +507,9 @@ version = "6.9.10-12+3" [[deps.ImageMetadata]] deps = ["AxisArrays", "ImageAxes", "ImageBase", "ImageCore"] -git-tree-sha1 = "36cbaebed194b292590cba2593da27b34763804a" +git-tree-sha1 = "355e2b974f2e3212a75dfb60519de21361ad3cb7" uuid = "bc367c6b-8a6b-528e-b4bd-a4b897500b49" -version = "0.9.8" +version = "0.9.9" [[deps.ImageMorphology]] deps = ["ImageCore", "LinearAlgebra", "Requires", "TiledIteration"] @@ -518,22 +518,22 @@ uuid = "787d08f9-d448-5407-9aad-5290dd7ab264" version = "0.3.2" [[deps.ImageQualityIndexes]] -deps = ["ImageContrastAdjustment", "ImageCore", "ImageDistances", "ImageFiltering", "LazyModules", "OffsetArrays", "SnoopPrecompile", "Statistics"] -git-tree-sha1 = "5985d467623f106523ed8351f255642b5141e7be" +deps = ["ImageContrastAdjustment", "ImageCore", "ImageDistances", "ImageFiltering", "LazyModules", "OffsetArrays", "PrecompileTools", "Statistics"] +git-tree-sha1 = "783b70725ed326340adf225be4889906c96b8fd1" uuid = "2996bd0c-7a13-11e9-2da2-2f5ce47296a9" -version = "0.3.4" +version = "0.3.7" [[deps.ImageSegmentation]] deps = ["Clustering", "DataStructures", "Distances", "Graphs", "ImageCore", "ImageFiltering", "ImageMorphology", "LinearAlgebra", "MetaGraphs", "RegionTrees", "SimpleWeightedGraphs", "StaticArrays", "Statistics"] -git-tree-sha1 = "fb0b597b4928e29fed0597724cfbb5940974f8ca" +git-tree-sha1 = "44664eea5408828c03e5addb84fa4f916132fc26" uuid = "80713f31-8817-5129-9cf8-209ff8fb23e1" -version = "1.8.0" +version = "1.8.1" [[deps.ImageShow]] deps = ["Base64", "ColorSchemes", "FileIO", "ImageBase", "ImageCore", "OffsetArrays", "StackViews"] -git-tree-sha1 = "ce28c68c900eed3cdbfa418be66ed053e54d4f56" +git-tree-sha1 = "3b5344bcdbdc11ad58f3b1956709b5b9345355de" uuid = "4e3cecfd-b093-5904-9786-8bbb286a6a31" -version = "0.3.7" +version = "0.3.8" [[deps.ImageTransformations]] deps = ["AxisAlgorithms", "ColorVectorSpace", "CoordinateTransformations", "ImageBase", "ImageCore", "Interpolations", "OffsetArrays", "Rotations", "StaticArrays"] @@ -548,10 +548,10 @@ uuid = "916415d5-f1e6-5110-898d-aaa5f9f070e0" version = "0.25.2" [[deps.Imath_jll]] -deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] -git-tree-sha1 = "87f7662e03a649cffa2e05bf19c303e168732d3e" +deps = ["Artifacts", "JLLWrappers", "Libdl"] +git-tree-sha1 = "3d09a9f60edf77f8a4d99f9e015e8fbf9989605d" uuid = "905a6f67-0a94-5f89-b386-d35d92009cd1" -version = "3.1.2+0" +version = "3.1.7+0" [[deps.IndirectArrays]] git-tree-sha1 = "012e604e1c7458645cb8b436f8fba789a51b257f" @@ -577,9 +577,9 @@ version = "0.1.5" [[deps.IntelOpenMP_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] -git-tree-sha1 = "d979e54b71da82f3a65b62553da4fc3d18c9004c" +git-tree-sha1 = "ad37c091f7d7daf900963171600d7c1c5c3ede32" uuid = "1d5cc7b8-4909-519e-a0f8-d0f5ad9712d0" -version = "2018.0.3+2" +version = "2023.2.0+0" [[deps.InteractiveUtils]] deps = ["Markdown"] @@ -593,30 +593,30 @@ version = "0.14.7" [[deps.IntervalSets]] deps = ["Dates", "Random", "Statistics"] -git-tree-sha1 = "16c0cc91853084cb5f58a78bd209513900206ce6" +git-tree-sha1 = "8e59ea773deee525c99a8018409f64f19fb719e6" uuid = "8197267c-284f-5f27-9208-e0e47529a953" -version = "0.7.4" +version = "0.7.7" [[deps.InverseFunctions]] deps = ["Test"] -git-tree-sha1 = "49510dfcb407e572524ba94aeae2fced1f3feb0f" +git-tree-sha1 = "68772f49f54b479fa88ace904f6127f0a3bb2e46" uuid = "3587e190-3f89-42d0-90ee-14403ec27112" -version = "0.1.8" +version = "0.1.12" [[deps.InvertedIndices]] -git-tree-sha1 = "82aec7a3dd64f4d9584659dc0b62ef7db2ef3e19" +git-tree-sha1 = "0dc7b50b8d436461be01300fd8cd45aa0274b038" uuid = "41ab1584-1d38-5bbf-9106-f11c6c58b48f" -version = "1.2.0" +version = "1.3.0" [[deps.IrrationalConstants]] -git-tree-sha1 = "3868cac300a188a7c3a74f9abd930e52ce1a7a51" +git-tree-sha1 = "630b497eafcc20001bba38a4651b327dcfc491d2" uuid = "92d709cd-6900-40b7-9082-c6be49f344b6" -version = "0.2.1" +version = "0.2.2" [[deps.IterTools]] -git-tree-sha1 = "fa6287a4469f5e048d763df38279ee729fbd44e5" +git-tree-sha1 = "4ced6667f9974fc5c5943fa5e2ef1ca43ea9e450" uuid = "c8e1da08-722c-5040-9ed9-7db0dc04731e" -version = "1.4.0" +version = "1.8.0" [[deps.IterativeSolvers]] deps = ["LinearAlgebra", "Printf", "Random", "RecipesBase", "SparseArrays"] @@ -636,10 +636,10 @@ uuid = "033835bb-8acc-5ee8-8aae-3f567f8a3819" version = "0.4.30" [[deps.JLLWrappers]] -deps = ["Preferences"] -git-tree-sha1 = "abc9885a7ca2052a736a600f7fa66209f96506e1" +deps = ["Artifacts", "Preferences"] +git-tree-sha1 = "7e5d6779a1e09a36db2a7b6cff50942a0a7d0fca" uuid = "692b3bcd-3c85-4b1f-b108-f13ce0eb3210" -version = "1.4.1" +version = "1.5.0" [[deps.JSON]] deps = ["Dates", "Mmap", "Parsers", "Unicode"] @@ -649,9 +649,9 @@ version = "0.21.3" [[deps.JpegTurbo]] deps = ["CEnum", "FileIO", "ImageCore", "JpegTurbo_jll", "TOML"] -git-tree-sha1 = "106b6aa272f294ba47e96bd3acbabdc0407b5c60" +git-tree-sha1 = "327713faef2a3e5c80f96bf38d1fa26f7a6ae29e" uuid = "b835a17e-a41a-41e7-81f0-2f016b05efe0" -version = "0.1.2" +version = "0.1.3" [[deps.JpegTurbo_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl"] @@ -661,9 +661,15 @@ version = "2.1.91+0" [[deps.JuliaInterpreter]] deps = ["CodeTracking", "InteractiveUtils", "Random", "UUIDs"] -git-tree-sha1 = "d9ae7a9081d9b1a3b2a5c1d3dac5e2fdaafbd538" +git-tree-sha1 = "81dc6aefcbe7421bd62cb6ca0e700779330acff8" uuid = "aa1ae85d-cabe-5617-a682-6adf51b2e16a" -version = "0.9.22" +version = "0.9.25" + +[[deps.KernelAbstractions]] +deps = ["Adapt", "Atomix", "InteractiveUtils", "LinearAlgebra", "MacroTools", "PrecompileTools", "Requires", "SparseArrays", "StaticArrays", "UUIDs", "UnsafeAtomics", "UnsafeAtomicsLLVM"] +git-tree-sha1 = "4c5875e4c228247e1c2b087669846941fb6e0118" +uuid = "63c18a36-062a-441e-b654-da1e3ab1ce7c" +version = "0.9.8" [[deps.LERC_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] @@ -671,6 +677,18 @@ git-tree-sha1 = "bf36f528eec6634efc60d7ec062008f171071434" uuid = "88015f11-f218-50d7-93a8-a6af411a945d" version = "3.0.0+1" +[[deps.LLVM]] +deps = ["CEnum", "LLVMExtra_jll", "Libdl", "Printf", "Unicode"] +git-tree-sha1 = "a9d2ce1d5007b1e8f6c5b89c5a31ff8bd146db5c" +uuid = "929cbde3-209d-540e-8aea-75f648917ca0" +version = "6.2.1" + +[[deps.LLVMExtra_jll]] +deps = ["Artifacts", "JLLWrappers", "LazyArtifacts", "Libdl", "TOML"] +git-tree-sha1 = "7ca6850ae880cc99b59b88517545f91a52020afa" +uuid = "dad2f222-ce93-54a1-a47d-0025e8a3acab" +version = "0.0.25+0" + [[deps.LaTeXStrings]] git-tree-sha1 = "f2355693d6778a178ade15952b7ac47a4ff97996" uuid = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f" @@ -731,9 +749,9 @@ uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" [[deps.LogExpFunctions]] deps = ["ChainRulesCore", "ChangesOfVariables", "DocStringExtensions", "InverseFunctions", "IrrationalConstants", "LinearAlgebra"] -git-tree-sha1 = "0a1b7c2863e44523180fdb3146534e265a91870b" +git-tree-sha1 = "7d6dd4e9212aebaeed356de34ccf262a3cd415aa" uuid = "2ab3a3ac-af41-5b50-aa03-7779005ae688" -version = "0.3.23" +version = "0.3.26" [[deps.Logging]] uuid = "56ddb016-857b-54e1-b83d-db4d58db5568" @@ -746,36 +764,36 @@ version = "2.3.0" [[deps.MKL_jll]] deps = ["Artifacts", "IntelOpenMP_jll", "JLLWrappers", "LazyArtifacts", "Libdl", "Pkg"] -git-tree-sha1 = "2ce8695e1e699b68702c03402672a69f54b8aca9" +git-tree-sha1 = "eb006abbd7041c28e0d16260e50a24f8f9104913" uuid = "856f044c-d86e-5d09-b602-aeab76dc8ba7" -version = "2022.2.0+0" +version = "2023.2.0+0" [[deps.MacroTools]] deps = ["Markdown", "Random"] -git-tree-sha1 = "42324d08725e200c23d4dfb549e0d5d89dede2d2" +git-tree-sha1 = "9ee1618cbf5240e6d4e0371d6f24065083f60c48" uuid = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09" -version = "0.5.10" +version = "0.5.11" [[deps.MappedArrays]] -git-tree-sha1 = "e8b359ef06ec72e8c030463fe02efe5527ee5142" +git-tree-sha1 = "2dab0221fe2b0f2cb6754eaa743cc266339f527e" uuid = "dbb5928d-eab1-5f90-85c2-b9b0edb7c900" -version = "0.4.1" +version = "0.4.2" [[deps.MarchingCubes]] -deps = ["SnoopPrecompile", "StaticArrays"] -git-tree-sha1 = "55aaf3fdf414b691a15875cfe5edb6e0daf4625a" +deps = ["PrecompileTools", "StaticArrays"] +git-tree-sha1 = "c8e29e2bacb98c9b6f10445227a8b0402f2f173a" uuid = "299715c1-40a9-479a-aaf9-4a633d36f717" -version = "0.1.6" +version = "0.1.8" [[deps.Markdown]] deps = ["Base64"] uuid = "d6f4376e-aef5-505a-96c1-9c027394607a" [[deps.MathOptInterface]] -deps = ["BenchmarkTools", "CodecBzip2", "CodecZlib", "DataStructures", "ForwardDiff", "JSON", "LinearAlgebra", "MutableArithmetics", "NaNMath", "OrderedCollections", "Printf", "SnoopPrecompile", "SparseArrays", "SpecialFunctions", "Test", "Unicode"] -git-tree-sha1 = "2a58c70db9287898dcc76b8394f0ff601c11b270" +deps = ["BenchmarkTools", "CodecBzip2", "CodecZlib", "DataStructures", "ForwardDiff", "JSON", "LinearAlgebra", "MutableArithmetics", "NaNMath", "OrderedCollections", "PrecompileTools", "Printf", "SparseArrays", "SpecialFunctions", "Test", "Unicode"] +git-tree-sha1 = "8bfc1519e9de0564d378b3886b21b9a2f04cbdb5" uuid = "b8f27783-ece8-5eb3-8dc8-9495eed66fee" -version = "1.12.0" +version = "1.20.0" [[deps.MbedTLS_jll]] deps = ["Artifacts", "Libdl"] @@ -809,15 +827,15 @@ version = "2022.2.1" [[deps.MutableArithmetics]] deps = ["LinearAlgebra", "SparseArrays", "Test"] -git-tree-sha1 = "3295d296288ab1a0a2528feb424b854418acff57" +git-tree-sha1 = "6985021d02ab8c509c841bb8b2becd3145a7b490" uuid = "d8a4904e-b15c-11e9-3269-09a3773c0cb0" -version = "1.2.3" +version = "1.3.3" [[deps.NNlib]] -deps = ["Adapt", "ChainRulesCore", "LinearAlgebra", "Pkg", "Random", "Requires", "Statistics"] -git-tree-sha1 = "33ad5a19dc6730d592d8ce91c14354d758e53b0e" +deps = ["Adapt", "Atomix", "ChainRulesCore", "GPUArraysCore", "KernelAbstractions", "LinearAlgebra", "Pkg", "Random", "Requires", "Statistics"] +git-tree-sha1 = "72240e3f5ca031937bd536182cb2c031da5f46dd" uuid = "872c559c-99b0-510c-b3b7-b6c96a88d5cd" -version = "0.8.19" +version = "0.8.21" [[deps.NaNMath]] deps = ["OpenLibm_jll"] @@ -833,15 +851,15 @@ version = "0.4.13" [[deps.Netpbm]] deps = ["FileIO", "ImageCore", "ImageMetadata"] -git-tree-sha1 = "5ae7ca23e13855b3aba94550f26146c01d259267" +git-tree-sha1 = "d92b107dbb887293622df7697a2223f9f8176fcd" uuid = "f09324ee-3d7c-5217-9330-fc30815ba969" -version = "1.1.0" +version = "1.1.1" [[deps.NetworkLayout]] -deps = ["GeometryBasics", "LinearAlgebra", "Random", "Requires", "SparseArrays"] -git-tree-sha1 = "cac8fc7ba64b699c678094fa630f49b80618f625" +deps = ["GeometryBasics", "LinearAlgebra", "Random", "Requires", "SparseArrays", "StaticArrays"] +git-tree-sha1 = "2bfd8cd7fba3e46ce48139ae93904ee848153660" uuid = "46757867-2c16-5918-afeb-47bfcb05e46a" -version = "0.4.4" +version = "0.4.5" [[deps.NetworkOptions]] uuid = "ca575930-c2e3-43a9-ace4-1e988b2c1908" @@ -849,9 +867,9 @@ version = "1.2.0" [[deps.OffsetArrays]] deps = ["Adapt"] -git-tree-sha1 = "82d7c9e310fe55aa54996e6f7f94674e2a38fcb4" +git-tree-sha1 = "2ac17d29c523ce1cd38e27785a7d23024853a4bb" uuid = "6fe1bfb0-de20-5000-8ca7-80f57d26f881" -version = "1.12.9" +version = "1.12.10" [[deps.OpenBLAS_jll]] deps = ["Artifacts", "CompilerSupportLibraries_jll", "Libdl"] @@ -865,10 +883,10 @@ uuid = "52e1d378-f018-4a11-a4be-720524705ac7" version = "0.3.2" [[deps.OpenEXR_jll]] -deps = ["Artifacts", "Imath_jll", "JLLWrappers", "Libdl", "Pkg", "Zlib_jll"] -git-tree-sha1 = "923319661e9a22712f24596ce81c54fc0366f304" +deps = ["Artifacts", "Imath_jll", "JLLWrappers", "Libdl", "Zlib_jll"] +git-tree-sha1 = "a4ca623df1ae99d09bc9868b008262d0c0ac1e4f" uuid = "18a262bb-aa17-5467-a713-aee519bc75cb" -version = "3.1.1+0" +version = "3.1.4+0" [[deps.OpenLibm_jll]] deps = ["Artifacts", "Libdl"] @@ -894,21 +912,21 @@ version = "1.4.1" [[deps.PDMats]] deps = ["LinearAlgebra", "SparseArrays", "SuiteSparse"] -git-tree-sha1 = "cf494dca75a69712a72b80bc48f59dcf3dea63ec" +git-tree-sha1 = "3129380a93388e5062e946974246fe3f2e7c73e2" uuid = "90014a1f-27ba-587c-ab20-58faa44d9150" -version = "0.11.16" +version = "0.11.18" [[deps.PNGFiles]] deps = ["Base64", "CEnum", "ImageCore", "IndirectArrays", "OffsetArrays", "libpng_jll"] -git-tree-sha1 = "f809158b27eba0c18c269cf2a2be6ed751d3e81d" +git-tree-sha1 = "9b02b27ac477cad98114584ff964e3052f656a0f" uuid = "f57f5aa1-a3ce-4bc8-8ab9-96f992907883" -version = "0.3.17" +version = "0.4.0" [[deps.PaddedViews]] deps = ["OffsetArrays"] -git-tree-sha1 = "03a7a85b76381a3d04c7a1656039197e70eda03d" +git-tree-sha1 = "0fac6313486baae819364c52b4f483450a9d793f" uuid = "5432bcbf-9aad-5242-b902-cca2824c8663" -version = "0.5.11" +version = "0.5.12" [[deps.Parameters]] deps = ["OrderedCollections", "UnPack"] @@ -917,10 +935,10 @@ uuid = "d96e819e-fc66-5662-9728-84c9c7592b0a" version = "0.12.3" [[deps.Parsers]] -deps = ["Dates", "SnoopPrecompile"] -git-tree-sha1 = "6f4fbcd1ad45905a5dee3f4256fabb49aa2110c6" +deps = ["Dates", "PrecompileTools", "UUIDs"] +git-tree-sha1 = "716e24b21538abc91f6205fd1d8363f39b442851" uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0" -version = "2.5.7" +version = "2.7.2" [[deps.Pkg]] deps = ["Artifacts", "Dates", "Downloads", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Serialization", "TOML", "Tar", "UUIDs", "p7zip_jll"] @@ -929,33 +947,39 @@ version = "1.8.0" [[deps.PkgVersion]] deps = ["Pkg"] -git-tree-sha1 = "f6cf8e7944e50901594838951729a1861e668cb8" +git-tree-sha1 = "f9501cc0430a26bc3d156ae1b5b0c1b47af4d6da" uuid = "eebad327-c553-4316-9ea0-9fa01ccd7688" -version = "0.3.2" +version = "0.3.3" [[deps.PlotUtils]] -deps = ["ColorSchemes", "Colors", "Dates", "Printf", "Random", "Reexport", "SnoopPrecompile", "Statistics"] -git-tree-sha1 = "c95373e73290cf50a8a22c3375e4625ded5c5280" +deps = ["ColorSchemes", "Colors", "Dates", "PrecompileTools", "Printf", "Random", "Reexport", "Statistics"] +git-tree-sha1 = "f92e1315dadf8c46561fb9396e525f7200cdc227" uuid = "995b91a9-d308-5afd-9ec6-746e21dbc043" -version = "1.3.4" +version = "1.3.5" [[deps.PooledArrays]] deps = ["DataAPI", "Future"] -git-tree-sha1 = "a6062fe4063cdafe78f4a0a81cfffb89721b30e7" +git-tree-sha1 = "36d8b4b899628fb92c2749eb488d884a926614d3" uuid = "2dfb63ee-cc39-5dd5-95bd-886bf059d720" -version = "1.4.2" +version = "1.4.3" + +[[deps.PrecompileTools]] +deps = ["Preferences"] +git-tree-sha1 = "03b4c25b43cb84cee5c90aa9b5ea0a78fd848d2f" +uuid = "aea7be01-6a6a-4083-8856-8a6e6704d82a" +version = "1.2.0" [[deps.Preferences]] deps = ["TOML"] -git-tree-sha1 = "47e5f437cc0e7ef2ce8406ce1e7e24d44915f88d" +git-tree-sha1 = "00805cd429dcb4870060ff49ef443486c262e38e" uuid = "21216c6a-2e73-6563-6e65-726566657250" -version = "1.3.0" +version = "1.4.1" [[deps.PrettyTables]] -deps = ["Crayons", "Formatting", "LaTeXStrings", "Markdown", "Reexport", "StringManipulation", "Tables"] -git-tree-sha1 = "96f6db03ab535bdb901300f88335257b0018689d" +deps = ["Crayons", "LaTeXStrings", "Markdown", "Printf", "Reexport", "StringManipulation", "Tables"] +git-tree-sha1 = "ee094908d720185ddbdc58dbe0c1cbe35453ec7a" uuid = "08abe8d2-0d0c-5749-adfa-8a2ac140af0d" -version = "2.2.2" +version = "2.2.7" [[deps.Printf]] deps = ["Unicode"] @@ -967,9 +991,9 @@ uuid = "9abbd945-dff8-562f-b5e8-e1ebf5ef1b79" [[deps.ProgressMeter]] deps = ["Distributed", "Printf"] -git-tree-sha1 = "d7a7aef8f8f2d537104f170139553b14dfe39fe9" +git-tree-sha1 = "00099623ffee15972c16111bcf84c58a0051257c" uuid = "92933f4c-e287-5a05-a399-4b506db050ca" -version = "1.7.2" +version = "1.9.0" [[deps.PyCall]] deps = ["Conda", "Dates", "Libdl", "LinearAlgebra", "MacroTools", "Serialization", "VersionParsing"] @@ -985,9 +1009,9 @@ version = "1.0.0" [[deps.QuadGK]] deps = ["DataStructures", "LinearAlgebra"] -git-tree-sha1 = "786efa36b7eff813723c4849c90456609cf06661" +git-tree-sha1 = "eeab25344bf9901146c0200a7ca64ea479f8bf5c" uuid = "1fd47b50-473d-5c70-9696-f719f8f3bcdc" -version = "2.8.1" +version = "2.9.0" [[deps.Quaternions]] deps = ["LinearAlgebra", "Random", "RealDot"] @@ -1010,9 +1034,9 @@ version = "0.3.2" [[deps.Ratios]] deps = ["Requires"] -git-tree-sha1 = "dc84268fe0e3335a62e315a3a7cf2afa7178a734" +git-tree-sha1 = "1342a47bf3260ee108163042310d26f2be5ec90b" uuid = "c84ed2f1-dad5-54f0-aa8e-dbefe2724439" -version = "0.4.3" +version = "0.4.5" [[deps.RealDot]] deps = ["LinearAlgebra"] @@ -1021,10 +1045,10 @@ uuid = "c1ae055f-0cd5-4b69-90a6-9a35b1a98df9" version = "0.1.0" [[deps.RecipesBase]] -deps = ["SnoopPrecompile"] -git-tree-sha1 = "261dddd3b862bd2c940cf6ca4d1c8fe593e457c8" +deps = ["PrecompileTools"] +git-tree-sha1 = "5c3d09cc4f31f5fc6af001c250bf1278733100ff" uuid = "3cdcf5f2-1ef4-517c-9805-6587b60abb01" -version = "1.3.3" +version = "1.3.4" [[deps.Reexport]] git-tree-sha1 = "45e428421666073eab6f2da5c9d310d99bb12f9b" @@ -1045,9 +1069,9 @@ version = "1.3.0" [[deps.ReverseDiff]] deps = ["ChainRulesCore", "DiffResults", "DiffRules", "ForwardDiff", "FunctionWrappers", "LinearAlgebra", "LogExpFunctions", "MacroTools", "NaNMath", "Random", "SpecialFunctions", "StaticArrays", "Statistics"] -git-tree-sha1 = "afc870db2b2c2df1ba3f7b199278bb071e4f6f90" +git-tree-sha1 = "d1235bdd57a93bd7504225b792b867e9a7df38d5" uuid = "37e2e3b7-166d-5795-8a7a-e32c996b4267" -version = "1.14.4" +version = "1.15.1" [[deps.Revise]] deps = ["CodeTracking", "Distributed", "FileWatching", "JuliaInterpreter", "LibGit2", "LoweredCodeUtils", "OrderedCollections", "Pkg", "REPL", "Requires", "UUIDs", "Unicode"] @@ -1068,10 +1092,10 @@ uuid = "f50d1b31-88e8-58de-be2c-1cc44531875f" version = "0.4.0+0" [[deps.Rotations]] -deps = ["LinearAlgebra", "Quaternions", "Random", "StaticArrays", "Statistics"] -git-tree-sha1 = "9480500060044fd25a1c341da53f34df7443c2f2" +deps = ["LinearAlgebra", "Quaternions", "Random", "StaticArrays"] +git-tree-sha1 = "0783924e4a332493f72490253ba4e668aeba1d73" uuid = "6038ab10-8711-5258-84ad-4b1120ba62dc" -version = "1.3.4" +version = "1.6.0" [[deps.SHA]] uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce" @@ -1079,9 +1103,9 @@ version = "0.7.0" [[deps.SentinelArrays]] deps = ["Dates", "Random"] -git-tree-sha1 = "77d3c4726515dca71f6d80fbb5e251088defe305" +git-tree-sha1 = "04bdff0b09c65ff3e06a05e3eb7b120223da3d39" uuid = "91c51154-3ec4-41a3-a24f-3f23e20d615c" -version = "1.3.18" +version = "1.4.0" [[deps.Serialization]] uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b" @@ -1110,9 +1134,9 @@ version = "1.3.0" [[deps.Sixel]] deps = ["Dates", "FileIO", "ImageCore", "IndirectArrays", "OffsetArrays", "REPL", "libsixel_jll"] -git-tree-sha1 = "8fb59825be681d451c246a795117f317ecbcaa28" +git-tree-sha1 = "2da10356e31327c7096832eb9cd86307a50b1eb6" uuid = "45858cf5-a6b0-47a3-bbea-62219f50df47" -version = "0.1.2" +version = "0.1.3" [[deps.SnoopPrecompile]] deps = ["Preferences"] @@ -1125,9 +1149,9 @@ uuid = "6462fe0b-24de-5631-8697-dd941f90decc" [[deps.SortingAlgorithms]] deps = ["DataStructures"] -git-tree-sha1 = "a4ada03f999bd01b3a25dcaa30b2d929fe537e00" +git-tree-sha1 = "c60ec5c62180f27efea3ba2908480f8055e17cee" uuid = "a2af1166-a08f-5f64-846c-94a0d3cef48c" -version = "1.1.0" +version = "1.1.1" [[deps.SparseArrays]] deps = ["LinearAlgebra", "Random"] @@ -1135,9 +1159,9 @@ uuid = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" [[deps.SpecialFunctions]] deps = ["ChainRulesCore", "IrrationalConstants", "LogExpFunctions", "OpenLibm_jll", "OpenSpecFun_jll"] -git-tree-sha1 = "ef28127915f4229c971eb43f3fc075dd3fe91880" +git-tree-sha1 = "e2cfc4012a19088254b3950b85c3c1d8882d864d" uuid = "276daf66-3868-5448-9aa4-cd146d93841b" -version = "2.2.0" +version = "2.3.1" [[deps.StackViews]] deps = ["OffsetArrays"] @@ -1158,9 +1182,9 @@ uuid = "90137ffa-7385-5640-81b9-e52037218182" version = "1.5.16" [[deps.StaticArraysCore]] -git-tree-sha1 = "6b7ba252635a5eff6a0b0664a41ee140a1c9e72a" +git-tree-sha1 = "36b3d696ce6366023a0ea192b4cd442268995a0d" uuid = "1e83bf80-4336-4d27-bf5d-d5a4f845583c" -version = "1.4.0" +version = "1.4.2" [[deps.Statistics]] deps = ["LinearAlgebra", "SparseArrays"] @@ -1168,9 +1192,9 @@ uuid = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" [[deps.StatsAPI]] deps = ["LinearAlgebra"] -git-tree-sha1 = "f9af7f195fb13589dd2e2d57fdb401717d2eb1f6" +git-tree-sha1 = "1ff449ad350c9c4cbc756624d6f8a8c3ef56d3ed" uuid = "82ae8749-77ed-4fe6-ae5f-f523153014b0" -version = "1.5.0" +version = "1.7.0" [[deps.StatsBase]] deps = ["DataAPI", "DataStructures", "LinearAlgebra", "LogExpFunctions", "Missings", "Printf", "Random", "SortingAlgorithms", "SparseArrays", "Statistics", "StatsAPI"] @@ -1180,20 +1204,21 @@ version = "0.33.21" [[deps.StatsFuns]] deps = ["ChainRulesCore", "HypergeometricFunctions", "InverseFunctions", "IrrationalConstants", "LogExpFunctions", "Reexport", "Rmath", "SpecialFunctions"] -git-tree-sha1 = "5aa6250a781e567388f3285fb4b0f214a501b4d5" +git-tree-sha1 = "f625d686d5a88bcd2b15cd81f18f98186fdc0c9a" uuid = "4c63d2b9-4356-54db-8cca-17b64c39e42c" -version = "1.2.1" +version = "1.3.0" [[deps.StringManipulation]] -git-tree-sha1 = "46da2434b41f41ac3594ee9816ce5541c6096123" +deps = ["PrecompileTools"] +git-tree-sha1 = "a04cabe79c5f01f4d723cc6704070ada0b9d46d5" uuid = "892a3eda-7b42-436c-8928-eab12a02cf0e" -version = "0.3.0" +version = "0.3.4" [[deps.StructArrays]] -deps = ["Adapt", "DataAPI", "GPUArraysCore", "StaticArraysCore", "Tables"] -git-tree-sha1 = "b03a3b745aa49b566f128977a7dd1be8711c5e71" +deps = ["Adapt", "ConstructionBase", "DataAPI", "GPUArraysCore", "StaticArraysCore", "Tables"] +git-tree-sha1 = "0a3db38e4cce3c54fe7a71f831cd7b6194a54213" uuid = "09ab397b-f2b6-538f-b94a-2f83cf4a842a" -version = "0.6.14" +version = "0.6.16" [[deps.SuiteSparse]] deps = ["Libdl", "LinearAlgebra", "Serialization", "SparseArrays"] @@ -1211,10 +1236,10 @@ uuid = "3783bdb8-4a98-5b6b-af9a-565f29a5fe9c" version = "1.0.1" [[deps.Tables]] -deps = ["DataAPI", "DataValueInterfaces", "IteratorInterfaceExtensions", "LinearAlgebra", "OrderedCollections", "TableTraits", "Test"] -git-tree-sha1 = "c79322d36826aa2f4fd8ecfa96ddb47b174ac78d" +deps = ["DataAPI", "DataValueInterfaces", "IteratorInterfaceExtensions", "LinearAlgebra", "OrderedCollections", "TableTraits"] +git-tree-sha1 = "a1f34829d5ac0ef499f6d84428bd6b4c71f02ead" uuid = "bd369af6-aec1-5ad0-b16a-f7cc5008161c" -version = "1.10.0" +version = "1.11.0" [[deps.Tar]] deps = ["ArgTools", "SHA"] @@ -1238,9 +1263,9 @@ version = "1.0.1" [[deps.TiffImages]] deps = ["ColorTypes", "DataStructures", "DocStringExtensions", "FileIO", "FixedPointNumbers", "IndirectArrays", "Inflate", "Mmap", "OffsetArrays", "PkgVersion", "ProgressMeter", "UUIDs"] -git-tree-sha1 = "7e6b0e3e571be0b4dd4d2a9a3a83b65c04351ccc" +git-tree-sha1 = "b7dc44cb005a7ef743b8fe98970afef003efdce7" uuid = "731e570b-9d59-4bfa-96dc-6df516fadf69" -version = "0.6.3" +version = "0.6.6" [[deps.TiledIteration]] deps = ["OffsetArrays"] @@ -1250,9 +1275,9 @@ version = "0.3.1" [[deps.TranscodingStreams]] deps = ["Random", "Test"] -git-tree-sha1 = "94f38103c984f89cf77c402f2a68dbd870f8165f" +git-tree-sha1 = "9a6ae7ed916312b41236fcef7e0af564ef934769" uuid = "3bb67fe8-82b1-5028-8e26-92a6c54297fa" -version = "0.9.11" +version = "0.9.13" [[deps.UUIDs]] deps = ["Random", "SHA"] @@ -1272,6 +1297,17 @@ git-tree-sha1 = "ef00b38d086414a54d679d81ced90fb7b0f03909" uuid = "b8865327-cd53-5732-bb35-84acbb429228" version = "3.4.0" +[[deps.UnsafeAtomics]] +git-tree-sha1 = "6331ac3440856ea1988316b46045303bef658278" +uuid = "013be700-e6cd-48c3-b4a1-df204f14c38f" +version = "0.2.1" + +[[deps.UnsafeAtomicsLLVM]] +deps = ["LLVM", "UnsafeAtomics"] +git-tree-sha1 = "323e3d0acf5e78a56dfae7bd8928c989b4f3083e" +uuid = "d80eeb9a-aca5-4d75-85e5-170c8b632249" +version = "0.1.3" + [[deps.VersionParsing]] git-tree-sha1 = "58d6e80b4ee071f5efd07fda82cb9fbe17200868" uuid = "81def892-9a0e-5fdd-b105-ffc91e053289" @@ -1279,7 +1315,7 @@ version = "1.3.0" [[deps.WaveFunctionCollapse]] deps = ["Distributions", "DocStringExtensions", "LinearAlgebra", "Random", "Revise", "SparseArrays", "StaticArrays"] -git-tree-sha1 = "911fb459691e1cc13fb1e56b27f2c2dce8e921ce" +git-tree-sha1 = "fbd331c0b87739af7df4e7101a313f28b4cd2685" repo-rev = "master" repo-url = "https://github.com/CNCLgithub/WaveFunctionCollapse.jl" uuid = "bc91b3db-6012-4156-9697-e03a5f4b0c51" @@ -1315,9 +1351,9 @@ version = "1.2.12+3" [[deps.Zstd_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl"] -git-tree-sha1 = "c6edfe154ad7b313c01aceca188c05c835c67360" +git-tree-sha1 = "49ce682769cd5de6c72dcf1b94ed7790cd08974c" uuid = "3161d3a3-bdf6-5164-811a-617609db77b4" -version = "1.5.4+0" +version = "1.5.5+0" [[deps.libblastrampoline_jll]] deps = ["Artifacts", "Libdl", "OpenBLAS_jll"] diff --git a/scripts/stimuli/generate_condlist.py b/scripts/stimuli/generate_condlist.py index aa72ed7..dced203 100755 --- a/scripts/stimuli/generate_condlist.py +++ b/scripts/stimuli/generate_condlist.py @@ -34,7 +34,7 @@ def main(): base = f'{r.scene}_{door}.png' aa_movies.append([base, base, r.flipx]) # then proceed to make `a -> b` trials - move = f'{r.scene}_{door}_shifted.png' + move = f'{r.scene}_{door}_removed.png' ab_movies.append([base, move, r.flipx]) # repeate aa trials to have a 50/50 split diff --git a/scripts/stimuli/generate_rooms.jl b/scripts/stimuli/generate_rooms.jl index d75b1f4..2fbedf6 100644 --- a/scripts/stimuli/generate_rooms.jl +++ b/scripts/stimuli/generate_rooms.jl @@ -9,21 +9,27 @@ using WaveFunctionCollapse function prop_weights() n = length(HT2D_vec) ws = zeros(n, n) + # column `i` in `ws` defines the weights over + # h-tiles (the rows) associated with `i`. + + # Want mostly empty space + ws[1, :] .= 1.0 # + + # Add "islands" + ws[2:end, 1] .= 0.7 + + # Grow islands with smaller parts for (i, hti) = enumerate(HT2D_vec) ni = count(hti) + ni < 2 && continue for (j, htj) = enumerate(HT2D_vec) nj = count(htj) - ws[i, j] = ((hti[3] == htj[1]) + (hti[4] == htj[2])) * - ((1+nj)/(1+ni)) + nj >= ni && continue + ws[j, i] += 10 * ((hti[3] == htj[1]) && (hti[4] == htj[2])) * + (1.0 / (nj+1)^2) end end - ws .+= 0.05 # adds noise to prop rules - - # ws = gen_prop_rules() - ws[1, :] .+= 0.75 # bump empty hyper tile - ws[2:end, 1] .+= 0.1 # - ws[end, 1] += 0.2 # return ws end @@ -42,8 +48,8 @@ function room_to_template(r::GridRoom; cell = walls[row_start:row_end, col_start:col_end] result[ir, ic] = WaveFunctionCollapse._ht2_hash_map[cell] end - gap_rng = (gap+1):(r-gap) - result[gap_rng, gap_rng] .= 0 + gap_rng = 2:(r-gap-1) + result[gap_rng, 2:(end-1)] .= 0 return sparse(result) end @@ -56,12 +62,14 @@ end function sample_obstacles(template::AbstractMatrix{Int64}, pr::Matrix{Float64}) - ws = WaveState(template, pr) + tmp = zeros(Int64, size(template)) + ws = WaveState(tmp, pr) collapse!(ws, pr) # empty out original walls ws.wave[template .!= 0] .= 1 expanded = WaveFunctionCollapse.expand(ws) - Set{Int64}(findall(vec(expanded))) + # REVIEW: why rot? + Set{Int64}(findall(vec(rotr90(expanded)))) end function sample_pair(left_room::GridRoom, @@ -81,42 +89,34 @@ function sample_pair(left_room::GridRoom, end function analyze_path(room::GridRoom, params::PathProcedure) - path, _, _, dm = path_procedure(room, params) - path_cost(path, dm) + path, _... = path_procedure(room, params) + d = FunctionalScenes.obstacle_diffusion(room, path, 0.2, 10) end function eval_pair(left_door::GridRoom, right_door::GridRoom, path_params::PathProcedure) # initial paths - initial_left_pc = analyze_path(left_door, path_params) - initial_right_pc = analyze_path(right_door, path_params) + diff_left = analyze_path(left_door, path_params) + diff_right = analyze_path(right_door, path_params) - # jitter each furniture - # consider as candidate if: - # 1. move does not change left path - # 2. move changes right path fs = furniture(left_door) candidates = falses(length(fs)) for (fi, f) in enumerate(fs) - length(f) > 3 && continue - shifted_left = remove(left_door, f) - shifted_left_pc = analyze_path(shifted_left, path_params) - abs(initial_left_pc - shifted_left_pc) > 0.1 && continue - shifted_right = remove(right_door, f) - shifted_right_pc = analyze_path(shifted_right, path_params) - (initial_right_pc - shifted_right_pc) < 3.5 && continue - candidates[fi] = true + candidates[fi] = + length(f) < 4 && + diff_left[fi] < 1.0 && + diff_right[fi] > 5.0 end # pick a random candidate - any(candidates) ? rand(findall(candidates)) : 0 + length(fs) > 3 && any(candidates) ? rand(findall(candidates)) : 0 end function main() - name = "09_18_2023" + name = "diffusion_09_18_2023" dataset_out = "/spaths/datasets/$(name)" isdir(dataset_out) || mkdir(dataset_out) @@ -138,7 +138,7 @@ function main() kernel_width = 3) # number of trials - n = 20 + n = 1 # empty room with doors left_cond = empty_room(room_steps, room_bounds, entrance, [doors[1]]) @@ -152,14 +152,16 @@ function main() # will store summary of generated rooms here df = DataFrame(scene = Int64[], flipx = Bool[], - furniture = Int64[]) + fidx = Int64[]) i = 1 - while i <= n + c = 0 + while i <= n && c < 100 * n # generate a room pair (left, right) = sample_pair(left_cond, right_cond, template, pws) fi = eval_pair(left, right, path_params) # no valid pair generated, try again or finish + c += 1 fi == 0 && continue # valid pair found, organize and store diff --git a/scripts/stimuli/render_rooms.jl b/scripts/stimuli/render_rooms.jl index 0c0715e..6130f36 100644 --- a/scripts/stimuli/render_rooms.jl +++ b/scripts/stimuli/render_rooms.jl @@ -26,16 +26,16 @@ function render_stims(df::DataFrame, name::String; p = "$(out)/$(r.scene)_$(door)" render(base, p; cycles_args...) - room = remove(base, - furniture(base)[r.furniture]) + f = furniture(base)[r.fidx] + rem = remove(base, f) p = "$(out)/$(r.scene)_$(door)_removed" - render(room, p; + render(rem, p; cycles_args...) end end function main() - cmd = ["09_18_2023", "0"] + cmd = ["diffusion_09_18_2023", "0"] args = parse_commandline(;x=cmd) name = args["dataset"] diff --git a/src/dgp/path_based/path_cost.jl b/src/dgp/path_based/path_cost.jl index 9acca24..2c64d10 100644 --- a/src/dgp/path_based/path_cost.jl +++ b/src/dgp/path_based/path_cost.jl @@ -175,14 +175,6 @@ function distance_to_path(r::GridRoom, vs, path::Array{T}) where {T<:Edge} n = steps(r)[2] loc = avg_location(vs, n) ne = length(path) - # d::Float64 = 0.0 - # for e in path - # v = dst(e) - # x = ceil(v / n) - # y = v % n - # d += sqrt((x - loc[1])^2 + (y - loc[2])^2) - # end - # return d / ne d::Float64 = Inf for e in path v = dst(e) @@ -240,6 +232,27 @@ function diffusion!( end +function obstacle_diffusion(room::GridRoom, + path::Array{T}, + p::Float64, n::Int64) where {T<:Edge} + vs = dst.(path) + m = zeros(Int64, steps(room)) + g = pathgraph(clear_room(room)) + clear_gds = gdistances(g, last(vs)) + fs = furniture(room) + isempty(fs) && return zeros(size(fs)) + terminal = reduce(union, fs) + diffusion!(m, g, p, n, terminal, clear_gds, vs) + + result = zeros(size(fs)) + for (fi, f) = enumerate(fs) + @inbounds for v in f + result[fi] += m[v] + end + end + return result +end + function obstacle_diffusion(room::GridRoom, f::Furniture, path::Array{T}, p::Float64, n::Int64) where {T<:Edge} diff --git a/src/rooms/furniture.jl b/src/rooms/furniture.jl index f8f750e..9ffeac0 100644 --- a/src/rooms/furniture.jl +++ b/src/rooms/furniture.jl @@ -54,6 +54,15 @@ function remove(r::GridRoom, f::Furniture)::GridRoom r.exits, g, d) end +function remove(r::GridRoom, i::Int64)::GridRoom + g = @> r steps grid PathGraph + d = deepcopy(r.data) + d[i] = floor_tile + prune_edges!(g, d) + GridRoom(r.steps, r.bounds, r.entrance, + r.exits, g, d) +end + function clear_room(r::GridRoom)::GridRoom g = @> r steps grid PathGraph d = deepcopy(r.data) From de93688ff1b777fa05660768779da8ca8b8c1616 Mon Sep 17 00:00:00 2001 From: belledon Date: Wed, 27 Sep 2023 07:48:34 -0400 Subject: [PATCH 10/10] updated rendering --- Manifest.toml | 503 +++++++++++++++++++++++------- env.d/Singularity | 63 +--- scripts/stimuli/generate_rooms.jl | 48 ++- scripts/stimuli/render_rooms.jl | 25 +- src/blender/blender.jl | 2 +- src/blender/render.py | 19 +- src/dgp/path_based/path_cost.jl | 1 + test/graphics/mitsuba_volume.py | 4 +- 8 files changed, 450 insertions(+), 215 deletions(-) diff --git a/Manifest.toml b/Manifest.toml index 7703882..4943ac4 100644 --- a/Manifest.toml +++ b/Manifest.toml @@ -1,25 +1,34 @@ # This file is machine-generated - editing it directly is not advised -julia_version = "1.8.5" +julia_version = "1.9.3" manifest_format = "2.0" project_hash = "7a6e5a825cc00237992813307dcbd5c72205c18d" [[deps.AbstractFFTs]] -deps = ["ChainRulesCore", "LinearAlgebra", "Test"] +deps = ["LinearAlgebra"] git-tree-sha1 = "d92ad398961a3ed262d8bf04a1a2b8340f915fef" uuid = "621f4979-c628-5d54-868e-fcf4e3e8185c" version = "1.5.0" +weakdeps = ["ChainRulesCore", "Test"] + + [deps.AbstractFFTs.extensions] + AbstractFFTsChainRulesCoreExt = "ChainRulesCore" + AbstractFFTsTestExt = "Test" [[deps.AbstractTrees]] -git-tree-sha1 = "03e0550477d86222521d254b741d470ba17ea0b5" +git-tree-sha1 = "faa260e4cb5aba097a73fab382dd4b5819d8ec8c" uuid = "1520ce14-60c1-5f80-bbc7-55ef81b5835c" -version = "0.3.4" +version = "0.4.4" [[deps.Adapt]] deps = ["LinearAlgebra", "Requires"] git-tree-sha1 = "76289dc51920fdc6e0013c872ba9551d54961c24" uuid = "79e6a3ab-5dfb-504d-930d-738a2a938a0e" version = "3.6.2" +weakdeps = ["StaticArrays"] + + [deps.Adapt.extensions] + AdaptStaticArraysExt = "StaticArrays" [[deps.ArgParse]] deps = ["Logging", "TextWrap"] @@ -37,6 +46,34 @@ git-tree-sha1 = "62e51b39331de8911e4a7ff6f5aaf38a5f4cc0ae" uuid = "ec485272-7323-5ecc-a04f-4719b315124d" version = "0.2.0" +[[deps.ArrayInterface]] +deps = ["Adapt", "LinearAlgebra", "Requires", "SparseArrays", "SuiteSparse"] +git-tree-sha1 = "f83ec24f76d4c8f525099b2ac475fc098138ec31" +uuid = "4fba245c-0d91-5ea0-9b3e-6abc04ee57a9" +version = "7.4.11" + + [deps.ArrayInterface.extensions] + ArrayInterfaceBandedMatricesExt = "BandedMatrices" + ArrayInterfaceBlockBandedMatricesExt = "BlockBandedMatrices" + ArrayInterfaceCUDAExt = "CUDA" + ArrayInterfaceGPUArraysCoreExt = "GPUArraysCore" + ArrayInterfaceStaticArraysCoreExt = "StaticArraysCore" + ArrayInterfaceTrackerExt = "Tracker" + + [deps.ArrayInterface.weakdeps] + BandedMatrices = "aae01518-5342-5314-be14-df237901396f" + BlockBandedMatrices = "ffab5731-97b5-5995-9138-79e8c1846df0" + CUDA = "052768ef-5323-5732-b1bb-66c8b64840ba" + GPUArraysCore = "46192b85-c4d5-4398-a991-12ede77f4527" + StaticArraysCore = "1e83bf80-4336-4d27-bf5d-d5a4f845583c" + Tracker = "9f7883ad-71c0-57eb-9f7f-b5c9e6d3789c" + +[[deps.ArrayInterfaceCore]] +deps = ["LinearAlgebra", "SnoopPrecompile", "SparseArrays", "SuiteSparse"] +git-tree-sha1 = "e5f08b5689b1aad068e01751889f2f615c7db36d" +uuid = "30b0a656-2188-435a-8636-2ec0e6a096e2" +version = "0.1.29" + [[deps.Artifacts]] uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33" @@ -67,6 +104,12 @@ git-tree-sha1 = "d9a9701b899b30332bbcb3e1679c41cce81fb0e8" uuid = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf" version = "1.3.2" +[[deps.BitTwiddlingConvenienceFunctions]] +deps = ["Static"] +git-tree-sha1 = "0c5f81f47bbbcf4aea7b2959135713459170798b" +uuid = "62783981-4cbd-42fc-bca8-16325de8dc4b" +version = "0.1.5" + [[deps.Bzip2_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] git-tree-sha1 = "19a35467a82e236ff51bc17a3a44b69ef35185a2" @@ -78,11 +121,17 @@ git-tree-sha1 = "eb4cb44a499229b3b8426dcfb5dd85333951ff90" uuid = "fa961155-64e5-5f13-b03f-caf6b980ea82" version = "0.4.2" +[[deps.CPUSummary]] +deps = ["CpuId", "IfElse", "PrecompileTools", "Static"] +git-tree-sha1 = "601f7e7b3d36f18790e2caf83a882d88e9b71ff1" +uuid = "2a0fbf3d-bb9c-48f3-b0a9-814d99fd7ab9" +version = "0.2.4" + [[deps.CSV]] -deps = ["CodecZlib", "Dates", "FilePathsBase", "InlineStrings", "Mmap", "Parsers", "PooledArrays", "SentinelArrays", "SnoopPrecompile", "Tables", "Unicode", "WeakRefStrings", "WorkerUtilities"] -git-tree-sha1 = "c700cce799b51c9045473de751e9319bdd1c6e94" +deps = ["CodecZlib", "Dates", "FilePathsBase", "InlineStrings", "Mmap", "Parsers", "PooledArrays", "PrecompileTools", "SentinelArrays", "Tables", "Unicode", "WeakRefStrings", "WorkerUtilities"] +git-tree-sha1 = "44dbf560808d49041989b8a96cae4cffbeb7966a" uuid = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b" -version = "0.10.9" +version = "0.10.11" [[deps.Calculus]] deps = ["LinearAlgebra"] @@ -102,17 +151,17 @@ git-tree-sha1 = "e30f2f4e20f7f186dc36529910beaedc60cfa644" uuid = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" version = "1.16.0" -[[deps.ChangesOfVariables]] -deps = ["InverseFunctions", "LinearAlgebra", "Test"] -git-tree-sha1 = "2fba81a302a7be671aefe194f0525ef231104e7f" -uuid = "9e997f8a-9a97-42d5-a9f1-ce6bfc15e2c0" -version = "0.1.8" +[[deps.CloseOpenIntervals]] +deps = ["Static", "StaticArrayInterface"] +git-tree-sha1 = "70232f82ffaab9dc52585e0dd043b5e0c6b714f1" +uuid = "fb6a15b2-703c-40df-9091-08a04967cfa9" +version = "0.1.12" [[deps.Clustering]] deps = ["Distances", "LinearAlgebra", "NearestNeighbors", "Printf", "Random", "SparseArrays", "Statistics", "StatsBase"] -git-tree-sha1 = "42fe66dbc8f1d09a44aa87f18d26926d06a35f84" +git-tree-sha1 = "b86ac2c5543660d238957dbde5ac04520ae977a7" uuid = "aaaa29a8-35af-508c-8bc3-b662a17a0fe5" -version = "0.15.3" +version = "0.15.4" [[deps.CodeTracking]] deps = ["InteractiveUtils", "UUIDs"] @@ -145,10 +194,14 @@ uuid = "3da002f7-5984-5a60-b8a6-cbb66c0b333f" version = "0.11.4" [[deps.ColorVectorSpace]] -deps = ["ColorTypes", "FixedPointNumbers", "LinearAlgebra", "SpecialFunctions", "Statistics", "TensorCore"] -git-tree-sha1 = "600cc5508d66b78aae350f7accdb58763ac18589" +deps = ["ColorTypes", "FixedPointNumbers", "LinearAlgebra", "Requires", "Statistics", "TensorCore"] +git-tree-sha1 = "a1f44953f2382ebb937d60dafbe2deea4bd23249" uuid = "c3611d14-8923-5661-9e6a-0046d554d3a4" -version = "0.9.10" +version = "0.10.0" +weakdeps = ["SpecialFunctions"] + + [deps.ColorVectorSpace.extensions] + SpecialFunctionsExt = "SpecialFunctions" [[deps.Colors]] deps = ["ColorTypes", "FixedPointNumbers", "Reexport"] @@ -163,15 +216,19 @@ uuid = "bbf7d656-a473-5ed7-a52c-81e309532950" version = "0.3.0" [[deps.Compat]] -deps = ["Dates", "LinearAlgebra", "UUIDs"] +deps = ["UUIDs"] git-tree-sha1 = "e460f044ca8b99be31d35fe54fc33a5c33dd8ed7" uuid = "34da2185-b29b-5c13-b0c7-acf172513d20" version = "4.9.0" +weakdeps = ["Dates", "LinearAlgebra"] + + [deps.Compat.extensions] + CompatLinearAlgebraExt = "LinearAlgebra" [[deps.CompilerSupportLibraries_jll]] deps = ["Artifacts", "Libdl"] uuid = "e66e0078-7015-5450-92f7-15fbd957f2ae" -version = "1.0.1+0" +version = "1.0.5+0" [[deps.ComputationalResources]] git-tree-sha1 = "52cb3ec90e8a8bea0e62e275ba577ad0f74821f7" @@ -189,6 +246,11 @@ deps = ["LinearAlgebra"] git-tree-sha1 = "c53fc348ca4d40d7b371e71fd52251839080cbc9" uuid = "187b0558-2788-49d3-abe0-74a17ed4e7c9" version = "1.5.4" +weakdeps = ["IntervalSets", "StaticArrays"] + + [deps.ConstructionBase.extensions] + ConstructionBaseIntervalSetsExt = "IntervalSets" + ConstructionBaseStaticArraysExt = "StaticArrays" [[deps.Contour]] git-tree-sha1 = "d05d9e7b7aedff4e5b51a029dced05cfb6125781" @@ -201,6 +263,12 @@ git-tree-sha1 = "f9d7112bfff8a19a3a4ea4e03a8e6a91fe8456bf" uuid = "150eb455-5306-5404-9cee-2592286d6298" version = "0.6.3" +[[deps.CpuId]] +deps = ["Markdown"] +git-tree-sha1 = "fcbb72b032692610bfbdb15018ac16a36cf2e406" +uuid = "adafc99b-e345-5852-983c-f28acb93d879" +version = "0.3.1" + [[deps.Crayons]] git-tree-sha1 = "249fe38abf76d48563e2f4556bebd215aa317e15" uuid = "a8cc5b0e-0ffa-5ad4-8c14-923d3ee1735f" @@ -217,16 +285,16 @@ uuid = "9a962f9c-6df0-11e9-0e5d-c546b8b5ee8a" version = "1.15.0" [[deps.DataFrames]] -deps = ["Compat", "DataAPI", "Future", "InlineStrings", "InvertedIndices", "IteratorInterfaceExtensions", "LinearAlgebra", "Markdown", "Missings", "PooledArrays", "PrettyTables", "Printf", "REPL", "Random", "Reexport", "SentinelArrays", "SnoopPrecompile", "SortingAlgorithms", "Statistics", "TableTraits", "Tables", "Unicode"] -git-tree-sha1 = "aa51303df86f8626a962fccb878430cdb0a97eee" +deps = ["Compat", "DataAPI", "DataStructures", "Future", "InlineStrings", "InvertedIndices", "IteratorInterfaceExtensions", "LinearAlgebra", "Markdown", "Missings", "PooledArrays", "PrecompileTools", "PrettyTables", "Printf", "REPL", "Random", "Reexport", "SentinelArrays", "SortingAlgorithms", "Statistics", "TableTraits", "Tables", "Unicode"] +git-tree-sha1 = "04c738083f29f86e62c8afc341f0967d8717bdb8" uuid = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" -version = "1.5.0" +version = "1.6.1" [[deps.DataStructures]] deps = ["Compat", "InteractiveUtils", "OrderedCollections"] -git-tree-sha1 = "d1fff3a548102f48987a52a2e0d114fa97d730f0" +git-tree-sha1 = "3dbd312d370723b6bb43ba9d02fc36abade4518d" uuid = "864edb3b-99cc-5e75-8d2d-829cb0a9cfe8" -version = "0.18.13" +version = "0.18.15" [[deps.DataValueInterfaces]] git-tree-sha1 = "bfc1187b79289637fa0ef6d4436ebdfe6905cbd6" @@ -237,12 +305,6 @@ version = "1.0.0" deps = ["Printf"] uuid = "ade2ca70-3891-5945-98fb-dc099432e06a" -[[deps.DensityInterface]] -deps = ["InverseFunctions", "Test"] -git-tree-sha1 = "80c3e8639e3353e5d2912fb3a1916b8455e2494b" -uuid = "b429d917-457f-4dbc-8f4c-0cc954292b1d" -version = "0.4.0" - [[deps.DiffResults]] deps = ["StaticArraysCore"] git-tree-sha1 = "782dd5f4561f5d267313f23853baaaa4c52ea621" @@ -256,20 +318,32 @@ uuid = "b552c78f-8df3-52c6-915a-8e097449b14b" version = "1.15.1" [[deps.Distances]] -deps = ["LinearAlgebra", "SparseArrays", "Statistics", "StatsAPI"] -git-tree-sha1 = "3258d0659f812acde79e8a74b11f17ac06d0ca04" +deps = ["LinearAlgebra", "Statistics", "StatsAPI"] +git-tree-sha1 = "b6def76ffad15143924a2199f72a5cd883a2e8a9" uuid = "b4f34e82-e78d-54a5-968a-f98e89d6e8f7" -version = "0.10.7" +version = "0.10.9" +weakdeps = ["SparseArrays"] + + [deps.Distances.extensions] + DistancesSparseArraysExt = "SparseArrays" [[deps.Distributed]] deps = ["Random", "Serialization", "Sockets"] uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b" [[deps.Distributions]] -deps = ["ChainRulesCore", "DensityInterface", "FillArrays", "LinearAlgebra", "PDMats", "Printf", "QuadGK", "Random", "SparseArrays", "SpecialFunctions", "Statistics", "StatsBase", "StatsFuns", "Test"] -git-tree-sha1 = "9a782b47da6ee4cb3d041764e0c6830469105984" +deps = ["FillArrays", "LinearAlgebra", "PDMats", "Printf", "QuadGK", "Random", "SpecialFunctions", "Statistics", "StatsAPI", "StatsBase", "StatsFuns", "Test"] +git-tree-sha1 = "938fe2981db009f531b6332e31c58e9584a2f9bd" uuid = "31c24e10-a181-5473-b8eb-7969acd0382f" -version = "0.25.83" +version = "0.25.100" + + [deps.Distributions.extensions] + DistributionsChainRulesCoreExt = "ChainRulesCore" + DistributionsDensityInterfaceExt = "DensityInterface" + + [deps.Distributions.weakdeps] + ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" + DensityInterface = "b429d917-457f-4dbc-8f4c-0cc954292b1d" [[deps.DocStringExtensions]] deps = ["LibGit2"] @@ -325,9 +399,9 @@ version = "3.3.10+0" [[deps.FileIO]] deps = ["Pkg", "Requires", "UUIDs"] -git-tree-sha1 = "7be5f99f7d15578798f338f5433b6c432ea8037b" +git-tree-sha1 = "299dc33549f68299137e51e6d49a13b5b1da9673" uuid = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549" -version = "1.16.0" +version = "1.16.1" [[deps.FilePathsBase]] deps = ["Compat", "Dates", "Mmap", "Printf", "Test", "UUIDs"] @@ -339,10 +413,15 @@ version = "0.9.20" uuid = "7b1f6079-737a-58dc-b8bc-7a2ca5c1b5ee" [[deps.FillArrays]] -deps = ["LinearAlgebra", "Random", "SparseArrays", "Statistics"] -git-tree-sha1 = "7072f1e3e5a8be51d525d64f63d3ec1287ff2790" +deps = ["LinearAlgebra", "Random"] +git-tree-sha1 = "a20eaa3ad64254c61eeb5f230d9306e937405434" uuid = "1a297f60-69ca-5386-bcde-b61e274b549b" -version = "0.13.11" +version = "1.6.1" +weakdeps = ["SparseArrays", "Statistics"] + + [deps.FillArrays.extensions] + FillArraysSparseArraysExt = "SparseArrays" + FillArraysStatisticsExt = "Statistics" [[deps.FixedPointNumbers]] deps = ["Statistics"] @@ -352,15 +431,19 @@ version = "0.8.4" [[deps.FlameGraphs]] deps = ["AbstractTrees", "Colors", "FileIO", "FixedPointNumbers", "IndirectArrays", "LeftChildRightSiblingTrees", "Profile"] -git-tree-sha1 = "d9eee53657f6a13ee51120337f98684c9c702264" +git-tree-sha1 = "bd1aaf448be998ea427b1c7213b8acf2e278498b" uuid = "08572546-2f56-4bcf-ba4e-bab62c3a3f89" -version = "0.2.10" +version = "1.0.0" [[deps.ForwardDiff]] -deps = ["CommonSubexpressions", "DiffResults", "DiffRules", "LinearAlgebra", "LogExpFunctions", "NaNMath", "Preferences", "Printf", "Random", "SpecialFunctions", "StaticArrays"] +deps = ["CommonSubexpressions", "DiffResults", "DiffRules", "LinearAlgebra", "LogExpFunctions", "NaNMath", "Preferences", "Printf", "Random", "SpecialFunctions"] git-tree-sha1 = "cf0fe81336da9fb90944683b8c41984b08793dad" uuid = "f6369f11-7733-5829-9624-2563aa707210" version = "0.10.36" +weakdeps = ["StaticArrays"] + + [deps.ForwardDiff.extensions] + ForwardDiffStaticArraysExt = "StaticArrays" [[deps.FunctionWrappers]] git-tree-sha1 = "d62485945ce5ae9c0c48f124a84998d755bae00e" @@ -385,9 +468,9 @@ version = "0.1.5" [[deps.Gen]] deps = ["Compat", "DataStructures", "Distributions", "ForwardDiff", "FunctionalCollections", "JSON", "LinearAlgebra", "MacroTools", "Parameters", "Random", "ReverseDiff", "SpecialFunctions"] -git-tree-sha1 = "a8aec17323e086e54823ec0fc86e756dcc70914a" +git-tree-sha1 = "9878ff4ab1990f5647e89b4228a3c9da5f0e69c7" uuid = "ea4f424c-a589-11e8-07c0-fd5c91b9da4a" -version = "0.4.5" +version = "0.4.6" [[deps.Gen_Compose]] deps = ["DataStructures", "FileIO", "Gen", "JLD2", "Revise", "UnPack"] @@ -439,12 +522,29 @@ git-tree-sha1 = "0e2bbef3c669498254a034394d6dd809e7a97ad6" uuid = "0bc81568-2411-4001-9bf1-c899fa54f385" version = "0.3.5" +[[deps.HistogramThresholding]] +deps = ["ImageBase", "LinearAlgebra", "MappedArrays"] +git-tree-sha1 = "7194dfbb2f8d945abdaf68fa9480a965d6661e69" +uuid = "2c695a8d-9458-5d45-9878-1b8a99cf7853" +version = "0.3.1" + +[[deps.HostCPUFeatures]] +deps = ["BitTwiddlingConvenienceFunctions", "IfElse", "Libdl", "Static"] +git-tree-sha1 = "eb8fed28f4994600e29beef49744639d985a04b2" +uuid = "3e5b6fbb-0976-4d2c-9146-d79de83f2fb0" +version = "0.1.16" + [[deps.HypergeometricFunctions]] deps = ["DualNumbers", "LinearAlgebra", "OpenLibm_jll", "SpecialFunctions"] git-tree-sha1 = "f218fe3736ddf977e0e772bc9a586b2383da2685" uuid = "34004b35-14d8-5ef3-9330-4cdb6864b03a" version = "0.3.23" +[[deps.IfElse]] +git-tree-sha1 = "debdd00ffef04665ccbb3e150747a77560e8fad1" +uuid = "615f187c-cbe4-4ef1-ba3b-2fcf58d6d173" +version = "0.1.1" + [[deps.ImageAxes]] deps = ["AxisArrays", "ImageBase", "ImageCore", "Reexport", "SimpleTraits"] git-tree-sha1 = "2e4520d67b0cef90865b3ef727594d2a58e0e1f8" @@ -453,9 +553,15 @@ version = "0.6.11" [[deps.ImageBase]] deps = ["ImageCore", "Reexport"] -git-tree-sha1 = "b51bb8cae22c66d0f6357e3bcb6363145ef20835" +git-tree-sha1 = "eb49b82c172811fd2c86759fa0553a2221feb909" uuid = "c817782e-172a-44cc-b673-b171935fbb9e" -version = "0.1.5" +version = "0.1.7" + +[[deps.ImageBinarization]] +deps = ["HistogramThresholding", "ImageCore", "LinearAlgebra", "Polynomials", "Reexport", "Statistics"] +git-tree-sha1 = "f5356e7203c4a9954962e3757c08033f2efe578a" +uuid = "cbc4b850-ae4b-5111-9e64-df94c024a13d" +version = "0.3.0" [[deps.ImageContrastAdjustment]] deps = ["ImageBase", "ImageCore", "ImageTransformations", "Parameters"] @@ -464,10 +570,16 @@ uuid = "f332f351-ec65-5f6a-b3d1-319c6670881a" version = "0.3.12" [[deps.ImageCore]] -deps = ["AbstractFFTs", "ColorVectorSpace", "Colors", "FixedPointNumbers", "Graphics", "MappedArrays", "MosaicViews", "OffsetArrays", "PaddedViews", "Reexport"] -git-tree-sha1 = "acf614720ef026d38400b3817614c45882d75500" +deps = ["AbstractFFTs", "ColorVectorSpace", "Colors", "FixedPointNumbers", "MappedArrays", "MosaicViews", "OffsetArrays", "PaddedViews", "PrecompileTools", "Reexport"] +git-tree-sha1 = "fc5d1d3443a124fde6e92d0260cd9e064eba69f8" uuid = "a09fc81d-aa75-5fe9-8630-4744c3626534" -version = "0.9.4" +version = "0.10.1" + +[[deps.ImageCorners]] +deps = ["ImageCore", "ImageFiltering", "PrecompileTools", "StaticArrays", "StatsBase"] +git-tree-sha1 = "24c52de051293745a9bad7d73497708954562b79" +uuid = "89d5987c-236e-4e32-acd0-25bd6bd87b70" +version = "0.1.3" [[deps.ImageDistances]] deps = ["Distances", "ImageCore", "ImageMorphology", "LinearAlgebra", "Statistics"] @@ -476,10 +588,10 @@ uuid = "51556ac3-7006-55f5-8cb3-34580c88182d" version = "0.2.17" [[deps.ImageFiltering]] -deps = ["CatIndices", "ComputationalResources", "DataStructures", "FFTViews", "FFTW", "ImageBase", "ImageCore", "LinearAlgebra", "OffsetArrays", "Reexport", "SnoopPrecompile", "SparseArrays", "StaticArrays", "Statistics", "TiledIteration"] -git-tree-sha1 = "f265e53558fbbf23e0d54e4fab7106c0f2a9e576" +deps = ["CatIndices", "ComputationalResources", "DataStructures", "FFTViews", "FFTW", "ImageBase", "ImageCore", "LinearAlgebra", "OffsetArrays", "PrecompileTools", "Reexport", "SparseArrays", "StaticArrays", "Statistics", "TiledIteration"] +git-tree-sha1 = "432ae2b430a18c58eb7eca9ef8d0f2db90bc749c" uuid = "6a3955dd-da59-5b1f-98d4-e7296123deb5" -version = "0.7.3" +version = "0.7.8" [[deps.ImageIO]] deps = ["FileIO", "IndirectArrays", "JpegTurbo", "LazyModules", "Netpbm", "OpenEXR", "PNGFiles", "QOI", "Sixel", "TiffImages", "UUIDs"] @@ -495,9 +607,9 @@ version = "0.5.2" [[deps.ImageMagick]] deps = ["FileIO", "ImageCore", "ImageMagick_jll", "InteractiveUtils"] -git-tree-sha1 = "ca8d917903e7a1126b6583a097c5cb7a0bedeac1" +git-tree-sha1 = "b0b765ff0b4c3ee20ce6740d843be8dfce48487c" uuid = "6218d12a-5da1-5696-b52f-db25d2ecc6d1" -version = "1.2.2" +version = "1.3.0" [[deps.ImageMagick_jll]] deps = ["JpegTurbo_jll", "Libdl", "Libtiff_jll", "Pkg", "Zlib_jll", "libpng_jll"] @@ -512,10 +624,10 @@ uuid = "bc367c6b-8a6b-528e-b4bd-a4b897500b49" version = "0.9.9" [[deps.ImageMorphology]] -deps = ["ImageCore", "LinearAlgebra", "Requires", "TiledIteration"] -git-tree-sha1 = "e7c68ab3df4a75511ba33fc5d8d9098007b579a8" +deps = ["DataStructures", "ImageCore", "LinearAlgebra", "LoopVectorization", "OffsetArrays", "Requires", "TiledIteration"] +git-tree-sha1 = "6f0a801136cb9c229aebea0df296cdcd471dbcd1" uuid = "787d08f9-d448-5407-9aad-5290dd7ab264" -version = "0.3.2" +version = "0.4.5" [[deps.ImageQualityIndexes]] deps = ["ImageContrastAdjustment", "ImageCore", "ImageDistances", "ImageFiltering", "LazyModules", "OffsetArrays", "PrecompileTools", "Statistics"] @@ -525,9 +637,9 @@ version = "0.3.7" [[deps.ImageSegmentation]] deps = ["Clustering", "DataStructures", "Distances", "Graphs", "ImageCore", "ImageFiltering", "ImageMorphology", "LinearAlgebra", "MetaGraphs", "RegionTrees", "SimpleWeightedGraphs", "StaticArrays", "Statistics"] -git-tree-sha1 = "44664eea5408828c03e5addb84fa4f916132fc26" +git-tree-sha1 = "3ff0ca203501c3eedde3c6fa7fd76b703c336b5f" uuid = "80713f31-8817-5129-9cf8-209ff8fb23e1" -version = "1.8.1" +version = "1.8.2" [[deps.ImageShow]] deps = ["Base64", "ColorSchemes", "FileIO", "ImageBase", "ImageCore", "OffsetArrays", "StackViews"] @@ -536,16 +648,16 @@ uuid = "4e3cecfd-b093-5904-9786-8bbb286a6a31" version = "0.3.8" [[deps.ImageTransformations]] -deps = ["AxisAlgorithms", "ColorVectorSpace", "CoordinateTransformations", "ImageBase", "ImageCore", "Interpolations", "OffsetArrays", "Rotations", "StaticArrays"] -git-tree-sha1 = "8717482f4a2108c9358e5c3ca903d3a6113badc9" +deps = ["AxisAlgorithms", "CoordinateTransformations", "ImageBase", "ImageCore", "Interpolations", "OffsetArrays", "Rotations", "StaticArrays"] +git-tree-sha1 = "7ec124670cbce8f9f0267ba703396960337e54b5" uuid = "02fcd773-0e25-5acc-982a-7f6622650795" -version = "0.9.5" +version = "0.10.0" [[deps.Images]] -deps = ["Base64", "FileIO", "Graphics", "ImageAxes", "ImageBase", "ImageContrastAdjustment", "ImageCore", "ImageDistances", "ImageFiltering", "ImageIO", "ImageMagick", "ImageMetadata", "ImageMorphology", "ImageQualityIndexes", "ImageSegmentation", "ImageShow", "ImageTransformations", "IndirectArrays", "IntegralArrays", "Random", "Reexport", "SparseArrays", "StaticArrays", "Statistics", "StatsBase", "TiledIteration"] -git-tree-sha1 = "03d1301b7ec885b266c0f816f338368c6c0b81bd" +deps = ["Base64", "FileIO", "Graphics", "ImageAxes", "ImageBase", "ImageBinarization", "ImageContrastAdjustment", "ImageCore", "ImageCorners", "ImageDistances", "ImageFiltering", "ImageIO", "ImageMagick", "ImageMetadata", "ImageMorphology", "ImageQualityIndexes", "ImageSegmentation", "ImageShow", "ImageTransformations", "IndirectArrays", "IntegralArrays", "Random", "Reexport", "SparseArrays", "StaticArrays", "Statistics", "StatsBase", "TiledIteration"] +git-tree-sha1 = "d438268ed7a665f8322572be0dabda83634d5f45" uuid = "916415d5-f1e6-5110-898d-aaa5f9f070e0" -version = "0.25.2" +version = "0.26.0" [[deps.Imath_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl"] @@ -592,16 +704,14 @@ uuid = "a98d9a8b-a2ab-59e6-89dd-64a1c18fca59" version = "0.14.7" [[deps.IntervalSets]] -deps = ["Dates", "Random", "Statistics"] +deps = ["Dates", "Random"] git-tree-sha1 = "8e59ea773deee525c99a8018409f64f19fb719e6" uuid = "8197267c-284f-5f27-9208-e0e47529a953" version = "0.7.7" +weakdeps = ["Statistics"] -[[deps.InverseFunctions]] -deps = ["Test"] -git-tree-sha1 = "68772f49f54b479fa88ace904f6127f0a3bb2e46" -uuid = "3587e190-3f89-42d0-90ee-14403ec27112" -version = "0.1.12" + [deps.IntervalSets.extensions] + IntervalSetsStatisticsExt = "Statistics" [[deps.InvertedIndices]] git-tree-sha1 = "0dc7b50b8d436461be01300fd8cd45aa0274b038" @@ -630,10 +740,10 @@ uuid = "82899510-4779-5014-852e-03e436cf321d" version = "1.0.0" [[deps.JLD2]] -deps = ["FileIO", "MacroTools", "Mmap", "OrderedCollections", "Pkg", "Printf", "Reexport", "TranscodingStreams", "UUIDs"] -git-tree-sha1 = "c3244ef42b7d4508c638339df1bdbf4353e144db" +deps = ["FileIO", "MacroTools", "Mmap", "OrderedCollections", "Pkg", "Printf", "Reexport", "Requires", "TranscodingStreams", "UUIDs"] +git-tree-sha1 = "c11d691a0dc8e90acfa4740d293ade57f68bfdbb" uuid = "033835bb-8acc-5ee8-8aae-3f567f8a3819" -version = "0.4.30" +version = "0.4.35" [[deps.JLLWrappers]] deps = ["Artifacts", "Preferences"] @@ -643,9 +753,9 @@ version = "1.5.0" [[deps.JSON]] deps = ["Dates", "Mmap", "Parsers", "Unicode"] -git-tree-sha1 = "3c837543ddb02250ef42f4738347454f95079d4e" +git-tree-sha1 = "31e996f0a15c7b280ba9f76636b3ff9e2ae58c9a" uuid = "682c06a0-de6a-54ab-a142-c8b1cf79cde6" -version = "0.21.3" +version = "0.21.4" [[deps.JpegTurbo]] deps = ["CEnum", "FileIO", "ImageCore", "JpegTurbo_jll", "TOML"] @@ -671,6 +781,12 @@ git-tree-sha1 = "4c5875e4c228247e1c2b087669846941fb6e0118" uuid = "63c18a36-062a-441e-b654-da1e3ab1ce7c" version = "0.9.8" + [deps.KernelAbstractions.extensions] + EnzymeExt = "EnzymeCore" + + [deps.KernelAbstractions.weakdeps] + EnzymeCore = "f151be2c-9106-41f4-ab19-57ee4f262869" + [[deps.LERC_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] git-tree-sha1 = "bf36f528eec6634efc60d7ec062008f171071434" @@ -694,6 +810,12 @@ git-tree-sha1 = "f2355693d6778a178ade15952b7ac47a4ff97996" uuid = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f" version = "1.3.0" +[[deps.LayoutPointers]] +deps = ["ArrayInterface", "LinearAlgebra", "ManualMemory", "SIMDTypes", "Static", "StaticArrayInterface"] +git-tree-sha1 = "88b8f66b604da079a627b6fb2860d3704a6729a1" +uuid = "10f19ff3-798f-405d-979b-55457f8fc047" +version = "0.1.14" + [[deps.Lazy]] deps = ["MacroTools"] git-tree-sha1 = "1370f8202dac30758f3c345f9909b97f53d87d3f" @@ -711,9 +833,9 @@ version = "0.3.1" [[deps.LeftChildRightSiblingTrees]] deps = ["AbstractTrees"] -git-tree-sha1 = "b864cb409e8e445688bc478ef87c0afe4f6d1f8d" +git-tree-sha1 = "fb6803dafae4a5d62ea5cab204b1e657d9737e7f" uuid = "1d6d02ad-be62-4b6b-8a6d-2f90e265016e" -version = "0.1.3" +version = "0.2.0" [[deps.LibCURL]] deps = ["LibCURL_jll", "MozillaCACerts_jll"] @@ -744,18 +866,39 @@ uuid = "89763e89-9b03-5906-acba-b20f662cd828" version = "4.4.0+0" [[deps.LinearAlgebra]] -deps = ["Libdl", "libblastrampoline_jll"] +deps = ["Libdl", "OpenBLAS_jll", "libblastrampoline_jll"] uuid = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" [[deps.LogExpFunctions]] -deps = ["ChainRulesCore", "ChangesOfVariables", "DocStringExtensions", "InverseFunctions", "IrrationalConstants", "LinearAlgebra"] +deps = ["DocStringExtensions", "IrrationalConstants", "LinearAlgebra"] git-tree-sha1 = "7d6dd4e9212aebaeed356de34ccf262a3cd415aa" uuid = "2ab3a3ac-af41-5b50-aa03-7779005ae688" version = "0.3.26" + [deps.LogExpFunctions.extensions] + LogExpFunctionsChainRulesCoreExt = "ChainRulesCore" + LogExpFunctionsChangesOfVariablesExt = "ChangesOfVariables" + LogExpFunctionsInverseFunctionsExt = "InverseFunctions" + + [deps.LogExpFunctions.weakdeps] + ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" + ChangesOfVariables = "9e997f8a-9a97-42d5-a9f1-ce6bfc15e2c0" + InverseFunctions = "3587e190-3f89-42d0-90ee-14403ec27112" + [[deps.Logging]] uuid = "56ddb016-857b-54e1-b83d-db4d58db5568" +[[deps.LoopVectorization]] +deps = ["ArrayInterface", "ArrayInterfaceCore", "CPUSummary", "CloseOpenIntervals", "DocStringExtensions", "HostCPUFeatures", "IfElse", "LayoutPointers", "LinearAlgebra", "OffsetArrays", "PolyesterWeave", "PrecompileTools", "SIMDTypes", "SLEEFPirates", "Static", "StaticArrayInterface", "ThreadingUtilities", "UnPack", "VectorizationBase"] +git-tree-sha1 = "c88a4afe1703d731b1c4fdf4e3c7e77e3b176ea2" +uuid = "bdcacae8-1622-11e9-2a5c-532679323890" +version = "0.12.165" +weakdeps = ["ChainRulesCore", "ForwardDiff", "SpecialFunctions"] + + [deps.LoopVectorization.extensions] + ForwardDiffExt = ["ChainRulesCore", "ForwardDiff"] + SpecialFunctionsExt = "SpecialFunctions" + [[deps.LoweredCodeUtils]] deps = ["JuliaInterpreter"] git-tree-sha1 = "60168780555f3e663c536500aa790b6368adc02a" @@ -774,6 +917,11 @@ git-tree-sha1 = "9ee1618cbf5240e6d4e0371d6f24065083f60c48" uuid = "1914dd2f-81c6-5fcd-8719-6d5c9610ff09" version = "0.5.11" +[[deps.ManualMemory]] +git-tree-sha1 = "bcaef4fc7a0cfe2cba636d84cda54b5e4e4ca3cd" +uuid = "d125e4d3-2237-4719-b19c-fa641b8a4667" +version = "0.1.8" + [[deps.MappedArrays]] git-tree-sha1 = "2dab0221fe2b0f2cb6754eaa743cc266339f527e" uuid = "dbb5928d-eab1-5f90-85c2-b9b0edb7c900" @@ -798,7 +946,7 @@ version = "1.20.0" [[deps.MbedTLS_jll]] deps = ["Artifacts", "Libdl"] uuid = "c8ffd9c3-330d-5841-b78e-0817d7145fa1" -version = "2.28.0+0" +version = "2.28.2+0" [[deps.MetaGraphs]] deps = ["Graphs", "JLD2", "Random"] @@ -823,7 +971,7 @@ version = "0.3.4" [[deps.MozillaCACerts_jll]] uuid = "14a3606d-f60d-562e-9121-12d972cd8159" -version = "2022.2.1" +version = "2022.10.11" [[deps.MutableArithmetics]] deps = ["LinearAlgebra", "SparseArrays", "Test"] @@ -837,6 +985,12 @@ git-tree-sha1 = "72240e3f5ca031937bd536182cb2c031da5f46dd" uuid = "872c559c-99b0-510c-b3b7-b6c96a88d5cd" version = "0.8.21" + [deps.NNlib.extensions] + NNlibAMDGPUExt = "AMDGPU" + + [deps.NNlib.weakdeps] + AMDGPU = "21141c5a-9bdb-4563-92ae-f87d6854732e" + [[deps.NaNMath]] deps = ["OpenLibm_jll"] git-tree-sha1 = "0877504529a3e5c3343c6f8b4c0381e57e4387e4" @@ -874,7 +1028,7 @@ version = "1.12.10" [[deps.OpenBLAS_jll]] deps = ["Artifacts", "CompilerSupportLibraries_jll", "Libdl"] uuid = "4536629a-c528-5b80-bd46-f80d51c5b363" -version = "0.3.20+0" +version = "0.3.21+4" [[deps.OpenEXR]] deps = ["Colors", "FileIO", "OpenEXR_jll"] @@ -906,9 +1060,9 @@ uuid = "7e02d93a-ae51-4f58-b602-d97af76e3b33" version = "0.3.19" [[deps.OrderedCollections]] -git-tree-sha1 = "85f8e6578bf1f9ee0d11e7bb1b1456435479d47c" +git-tree-sha1 = "2e73fe17cac3c62ad1aebe70d44c963c3cfdc3e3" uuid = "bac558e1-5e72-5ebc-8fee-abe8a469f55d" -version = "1.4.1" +version = "1.6.2" [[deps.PDMats]] deps = ["LinearAlgebra", "SparseArrays", "SuiteSparse"] @@ -941,9 +1095,9 @@ uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0" version = "2.7.2" [[deps.Pkg]] -deps = ["Artifacts", "Dates", "Downloads", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Serialization", "TOML", "Tar", "UUIDs", "p7zip_jll"] +deps = ["Artifacts", "Dates", "Downloads", "FileWatching", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Serialization", "TOML", "Tar", "UUIDs", "p7zip_jll"] uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" -version = "1.8.0" +version = "1.9.2" [[deps.PkgVersion]] deps = ["Pkg"] @@ -957,6 +1111,28 @@ git-tree-sha1 = "f92e1315dadf8c46561fb9396e525f7200cdc227" uuid = "995b91a9-d308-5afd-9ec6-746e21dbc043" version = "1.3.5" +[[deps.PolyesterWeave]] +deps = ["BitTwiddlingConvenienceFunctions", "CPUSummary", "IfElse", "Static", "ThreadingUtilities"] +git-tree-sha1 = "240d7170f5ffdb285f9427b92333c3463bf65bf6" +uuid = "1d0040c9-8b98-4ee7-8388-3f51789ca0ad" +version = "0.2.1" + +[[deps.Polynomials]] +deps = ["LinearAlgebra", "RecipesBase"] +git-tree-sha1 = "3aa2bb4982e575acd7583f01531f241af077b163" +uuid = "f27b6e38-b328-58d1-80ce-0feddd5e7a45" +version = "3.2.13" + + [deps.Polynomials.extensions] + PolynomialsChainRulesCoreExt = "ChainRulesCore" + PolynomialsMakieCoreExt = "MakieCore" + PolynomialsMutableArithmeticsExt = "MutableArithmetics" + + [deps.Polynomials.weakdeps] + ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" + MakieCore = "20f20a25-4f0e-4fdf-b5d1-57303727442b" + MutableArithmetics = "d8a4904e-b15c-11e9-3269-09a3773c0cb0" + [[deps.PooledArrays]] deps = ["DataAPI", "Future"] git-tree-sha1 = "36d8b4b899628fb92c2749eb488d884a926614d3" @@ -997,9 +1173,9 @@ version = "1.9.0" [[deps.PyCall]] deps = ["Conda", "Dates", "Libdl", "LinearAlgebra", "MacroTools", "Serialization", "VersionParsing"] -git-tree-sha1 = "62f417f6ad727987c755549e9cd88c46578da562" +git-tree-sha1 = "43d304ac6f0354755f1d60730ece8c499980f7ba" uuid = "438e738f-606a-5dbb-bf0a-cddfbfd45ab0" -version = "1.95.1" +version = "1.96.1" [[deps.QOI]] deps = ["ColorTypes", "FileIO", "FixedPointNumbers"] @@ -1037,6 +1213,10 @@ deps = ["Requires"] git-tree-sha1 = "1342a47bf3260ee108163042310d26f2be5ec90b" uuid = "c84ed2f1-dad5-54f0-aa8e-dbefe2724439" version = "0.4.5" +weakdeps = ["FixedPointNumbers"] + + [deps.Ratios.extensions] + RatiosFixedPointNumbersExt = "FixedPointNumbers" [[deps.RealDot]] deps = ["LinearAlgebra"] @@ -1075,9 +1255,9 @@ version = "1.15.1" [[deps.Revise]] deps = ["CodeTracking", "Distributed", "FileWatching", "JuliaInterpreter", "LibGit2", "LoweredCodeUtils", "OrderedCollections", "Pkg", "REPL", "Requires", "UUIDs", "Unicode"] -git-tree-sha1 = "90cb983381a9dc7d3dff5fb2d1ee52cd59877412" +git-tree-sha1 = "7364d5f608f3492a4352ab1d40b3916955dc6aec" uuid = "295af30f-e4ad-537b-8983-00126c2a3abe" -version = "3.5.1" +version = "3.5.5" [[deps.Rmath]] deps = ["Random", "Rmath_jll"] @@ -1101,6 +1281,17 @@ version = "1.6.0" uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce" version = "0.7.0" +[[deps.SIMDTypes]] +git-tree-sha1 = "330289636fb8107c5f32088d2741e9fd7a061a5c" +uuid = "94e857df-77ce-4151-89e5-788b33177be4" +version = "0.1.0" + +[[deps.SLEEFPirates]] +deps = ["IfElse", "Static", "VectorizationBase"] +git-tree-sha1 = "4b8586aece42bee682399c4c4aee95446aa5cd19" +uuid = "476501e8-09a2-5ece-8869-fb82de89a1fa" +version = "0.6.39" + [[deps.SentinelArrays]] deps = ["Dates", "Random"] git-tree-sha1 = "04bdff0b09c65ff3e06a05e3eb7b120223da3d39" @@ -1127,10 +1318,10 @@ uuid = "699a6c99-e7fa-54fc-8d76-47d257e15c1d" version = "0.9.4" [[deps.SimpleWeightedGraphs]] -deps = ["Graphs", "LinearAlgebra", "Markdown", "SparseArrays", "Test"] -git-tree-sha1 = "7d0b07df35fccf9b866a94bcab98822a87a3cb6f" +deps = ["Graphs", "LinearAlgebra", "Markdown", "SparseArrays"] +git-tree-sha1 = "4b33e0e081a825dbfaf314decf58fa47e53d6acb" uuid = "47aef6b3-ad0c-573a-a1e2-d07658019622" -version = "1.3.0" +version = "1.4.0" [[deps.Sixel]] deps = ["Dates", "FileIO", "ImageCore", "IndirectArrays", "OffsetArrays", "REPL", "libsixel_jll"] @@ -1154,14 +1345,24 @@ uuid = "a2af1166-a08f-5f64-846c-94a0d3cef48c" version = "1.1.1" [[deps.SparseArrays]] -deps = ["LinearAlgebra", "Random"] +deps = ["Libdl", "LinearAlgebra", "Random", "Serialization", "SuiteSparse_jll"] uuid = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" [[deps.SpecialFunctions]] -deps = ["ChainRulesCore", "IrrationalConstants", "LogExpFunctions", "OpenLibm_jll", "OpenSpecFun_jll"] +deps = ["IrrationalConstants", "LogExpFunctions", "OpenLibm_jll", "OpenSpecFun_jll"] git-tree-sha1 = "e2cfc4012a19088254b3950b85c3c1d8882d864d" uuid = "276daf66-3868-5448-9aa4-cd146d93841b" version = "2.3.1" +weakdeps = ["ChainRulesCore"] + + [deps.SpecialFunctions.extensions] + SpecialFunctionsChainRulesCoreExt = "ChainRulesCore" + +[[deps.StableRNGs]] +deps = ["Random", "Test"] +git-tree-sha1 = "3be7d49667040add7ee151fefaf1f8c04c8c8276" +uuid = "860ef19b-820b-49d6-a774-d7a799459cd3" +version = "1.0.0" [[deps.StackViews]] deps = ["OffsetArrays"] @@ -1170,16 +1371,37 @@ uuid = "cae243ae-269e-4f55-b966-ac2d0dc13c15" version = "0.1.1" [[deps.StatProfilerHTML]] -deps = ["DataStructures", "Dates", "FlameGraphs", "HAML", "Profile", "SHA", "Test"] -git-tree-sha1 = "768fdebd755d6d0e16a9f3584a727a30a7a45087" +deps = ["DataStructures", "Dates", "FlameGraphs", "HAML", "OrderedCollections", "Profile", "Random", "SHA", "StableRNGs", "Test"] +git-tree-sha1 = "548c8268e32d405f0d9e7233833c4cee6427bbe8" uuid = "a8a75453-ed82-57c9-9e16-4cd1196ecbf5" -version = "1.4.2" +version = "1.6.0" + +[[deps.Static]] +deps = ["IfElse"] +git-tree-sha1 = "f295e0a1da4ca425659c57441bcb59abb035a4bc" +uuid = "aedffcd0-7271-4cad-89d0-dc628f76c6d3" +version = "0.8.8" + +[[deps.StaticArrayInterface]] +deps = ["ArrayInterface", "Compat", "IfElse", "LinearAlgebra", "PrecompileTools", "Requires", "SparseArrays", "Static", "SuiteSparse"] +git-tree-sha1 = "03fec6800a986d191f64f5c0996b59ed526eda25" +uuid = "0d7ed370-da01-4f52-bd93-41d350b8b718" +version = "1.4.1" +weakdeps = ["OffsetArrays", "StaticArrays"] + + [deps.StaticArrayInterface.extensions] + StaticArrayInterfaceOffsetArraysExt = "OffsetArrays" + StaticArrayInterfaceStaticArraysExt = "StaticArrays" [[deps.StaticArrays]] -deps = ["LinearAlgebra", "Random", "StaticArraysCore", "Statistics"] -git-tree-sha1 = "2d7d9e1ddadc8407ffd460e24218e37ef52dd9a3" +deps = ["LinearAlgebra", "Random", "StaticArraysCore"] +git-tree-sha1 = "51621cca8651d9e334a659443a74ce50a3b6dfab" uuid = "90137ffa-7385-5640-81b9-e52037218182" -version = "1.5.16" +version = "1.6.3" +weakdeps = ["Statistics"] + + [deps.StaticArrays.extensions] + StaticArraysStatisticsExt = "Statistics" [[deps.StaticArraysCore]] git-tree-sha1 = "36b3d696ce6366023a0ea192b4cd442268995a0d" @@ -1189,6 +1411,7 @@ version = "1.4.2" [[deps.Statistics]] deps = ["LinearAlgebra", "SparseArrays"] uuid = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" +version = "1.9.0" [[deps.StatsAPI]] deps = ["LinearAlgebra"] @@ -1198,16 +1421,24 @@ version = "1.7.0" [[deps.StatsBase]] deps = ["DataAPI", "DataStructures", "LinearAlgebra", "LogExpFunctions", "Missings", "Printf", "Random", "SortingAlgorithms", "SparseArrays", "Statistics", "StatsAPI"] -git-tree-sha1 = "d1bf48bfcc554a3761a133fe3a9bb01488e06916" +git-tree-sha1 = "75ebe04c5bed70b91614d684259b661c9e6274a4" uuid = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91" -version = "0.33.21" +version = "0.34.0" [[deps.StatsFuns]] -deps = ["ChainRulesCore", "HypergeometricFunctions", "InverseFunctions", "IrrationalConstants", "LogExpFunctions", "Reexport", "Rmath", "SpecialFunctions"] +deps = ["HypergeometricFunctions", "IrrationalConstants", "LogExpFunctions", "Reexport", "Rmath", "SpecialFunctions"] git-tree-sha1 = "f625d686d5a88bcd2b15cd81f18f98186fdc0c9a" uuid = "4c63d2b9-4356-54db-8cca-17b64c39e42c" version = "1.3.0" + [deps.StatsFuns.extensions] + StatsFunsChainRulesCoreExt = "ChainRulesCore" + StatsFunsInverseFunctionsExt = "InverseFunctions" + + [deps.StatsFuns.weakdeps] + ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4" + InverseFunctions = "3587e190-3f89-42d0-90ee-14403ec27112" + [[deps.StringManipulation]] deps = ["PrecompileTools"] git-tree-sha1 = "a04cabe79c5f01f4d723cc6704070ada0b9d46d5" @@ -1224,10 +1455,15 @@ version = "0.6.16" deps = ["Libdl", "LinearAlgebra", "Serialization", "SparseArrays"] uuid = "4607b0f0-06f3-5cda-b6b1-a6196a1729e9" +[[deps.SuiteSparse_jll]] +deps = ["Artifacts", "Libdl", "Pkg", "libblastrampoline_jll"] +uuid = "bea87d4a-7f5b-5778-9afe-8cc45184846c" +version = "5.10.1+6" + [[deps.TOML]] deps = ["Dates"] uuid = "fa267f1f-6049-4f14-aa54-33bafae1ed76" -version = "1.0.0" +version = "1.0.3" [[deps.TableTraits]] deps = ["IteratorInterfaceExtensions"] @@ -1244,7 +1480,7 @@ version = "1.11.0" [[deps.Tar]] deps = ["ArgTools", "SHA"] uuid = "a4e569a6-e804-4fa4-b0f3-eef7a1d5b13e" -version = "1.10.1" +version = "1.10.0" [[deps.TensorCore]] deps = ["LinearAlgebra"] @@ -1261,6 +1497,12 @@ git-tree-sha1 = "9250ef9b01b66667380cf3275b3f7488d0e25faf" uuid = "b718987f-49a8-5099-9789-dcd902bef87d" version = "1.0.1" +[[deps.ThreadingUtilities]] +deps = ["ManualMemory"] +git-tree-sha1 = "eda08f7e9818eb53661b3deb74e3159460dfbc27" +uuid = "8290d209-cae3-49c0-8002-c8c24d57dab5" +version = "0.5.2" + [[deps.TiffImages]] deps = ["ColorTypes", "DataStructures", "DocStringExtensions", "FileIO", "FixedPointNumbers", "IndirectArrays", "Inflate", "Mmap", "OffsetArrays", "PkgVersion", "ProgressMeter", "UUIDs"] git-tree-sha1 = "b7dc44cb005a7ef743b8fe98970afef003efdce7" @@ -1268,10 +1510,10 @@ uuid = "731e570b-9d59-4bfa-96dc-6df516fadf69" version = "0.6.6" [[deps.TiledIteration]] -deps = ["OffsetArrays"] -git-tree-sha1 = "5683455224ba92ef59db72d10690690f4a8dc297" +deps = ["OffsetArrays", "StaticArrayInterface"] +git-tree-sha1 = "1176cc31e867217b06928e2f140c90bd1bc88283" uuid = "06e1c1a7-607b-532d-9fad-de7d9aa2abac" -version = "0.3.1" +version = "0.5.0" [[deps.TranscodingStreams]] deps = ["Random", "Test"] @@ -1292,10 +1534,25 @@ version = "1.0.2" uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5" [[deps.UnicodePlots]] -deps = ["ColorSchemes", "ColorTypes", "Contour", "Crayons", "Dates", "LinearAlgebra", "MarchingCubes", "NaNMath", "Printf", "Requires", "SnoopPrecompile", "SparseArrays", "StaticArrays", "StatsBase"] -git-tree-sha1 = "ef00b38d086414a54d679d81ced90fb7b0f03909" +deps = ["ColorSchemes", "ColorTypes", "Contour", "Crayons", "Dates", "LinearAlgebra", "MarchingCubes", "NaNMath", "PrecompileTools", "Printf", "Requires", "SparseArrays", "StaticArrays", "StatsBase"] +git-tree-sha1 = "b96de03092fe4b18ac7e4786bee55578d4b75ae8" uuid = "b8865327-cd53-5732-bb35-84acbb429228" -version = "3.4.0" +version = "3.6.0" + + [deps.UnicodePlots.extensions] + FreeTypeExt = ["FileIO", "FreeType"] + ImageInTerminalExt = "ImageInTerminal" + IntervalSetsExt = "IntervalSets" + TermExt = "Term" + UnitfulExt = "Unitful" + + [deps.UnicodePlots.weakdeps] + FileIO = "5789e2e9-d7fb-5bc7-8068-2c6fae9b9549" + FreeType = "b38be410-82b0-50bf-ab77-7b57e271db43" + ImageInTerminal = "d8c32880-2388-543b-8c61-d9f865259254" + IntervalSets = "8197267c-284f-5f27-9208-e0e47529a953" + Term = "22787eb5-b846-44ae-b979-8e399b8463ab" + Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d" [[deps.UnsafeAtomics]] git-tree-sha1 = "6331ac3440856ea1988316b46045303bef658278" @@ -1308,6 +1565,12 @@ git-tree-sha1 = "323e3d0acf5e78a56dfae7bd8928c989b4f3083e" uuid = "d80eeb9a-aca5-4d75-85e5-170c8b632249" version = "0.1.3" +[[deps.VectorizationBase]] +deps = ["ArrayInterface", "CPUSummary", "HostCPUFeatures", "IfElse", "LayoutPointers", "Libdl", "LinearAlgebra", "SIMDTypes", "Static", "StaticArrayInterface"] +git-tree-sha1 = "b182207d4af54ac64cbc71797765068fdeff475d" +uuid = "3d5dd08c-fd9d-11e8-17fa-ed2836048c2f" +version = "0.21.64" + [[deps.VersionParsing]] git-tree-sha1 = "58d6e80b4ee071f5efd07fda82cb9fbe17200868" uuid = "81def892-9a0e-5fdd-b105-ffc91e053289" @@ -1315,9 +1578,7 @@ version = "1.3.0" [[deps.WaveFunctionCollapse]] deps = ["Distributions", "DocStringExtensions", "LinearAlgebra", "Random", "Revise", "SparseArrays", "StaticArrays"] -git-tree-sha1 = "fbd331c0b87739af7df4e7101a313f28b4cd2685" -repo-rev = "master" -repo-url = "https://github.com/CNCLgithub/WaveFunctionCollapse.jl" +path = "/home/mario/work/dev/FunctionalScenes/env.d/jenv/dev/WaveFunctionCollapse" uuid = "bc91b3db-6012-4156-9697-e03a5f4b0c51" version = "0.1.0" @@ -1347,7 +1608,7 @@ version = "0.2.1" [[deps.Zlib_jll]] deps = ["Libdl"] uuid = "83775a58-1f1d-513f-b197-d71354ab007a" -version = "1.2.12+3" +version = "1.2.13+0" [[deps.Zstd_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl"] @@ -1356,9 +1617,9 @@ uuid = "3161d3a3-bdf6-5164-811a-617609db77b4" version = "1.5.5+0" [[deps.libblastrampoline_jll]] -deps = ["Artifacts", "Libdl", "OpenBLAS_jll"] +deps = ["Artifacts", "Libdl"] uuid = "8e850b90-86db-534c-a0d3-1478176c7d93" -version = "5.1.1+0" +version = "5.8.0+0" [[deps.libpng_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg", "Zlib_jll"] diff --git a/env.d/Singularity b/env.d/Singularity index 491e09e..aed58fd 100644 --- a/env.d/Singularity +++ b/env.d/Singularity @@ -1,63 +1,26 @@ -bootstrap: docker -from: nvidia/cuda:11.7.0-cudnn8-devel-ubuntu20.04 +bootstrap: localimage +from: env.d/base.sif %environment # setup PATH to point to julia and blender - # export PATH=$PATH:"/usr/local/blender" - export PATH=$PATH:"/usr/local/julia-1.8.5/bin" + export PATH=$PATH:"/usr/local/blender" + export PATH=$PATH:"/usr/local/julia-1.9.3/bin" %runscript exec bash "$@" -%post - export DEBIAN_FRONTEND=noninteractive - export TZ=Etc/UTC - rm /etc/apt/sources.list.d/cuda.list - # rm /etc/apt/sources.list.d/nvidia-ml.list - apt-get update - apt-get install -y software-properties-common - apt-get install -y build-essential \ - wget \ - git \ - ffmpeg \ - cmake \ - python3.9-dev \ - python3-pip \ - libopencv-dev \ - libturbojpeg0-dev \ - blender - apt-get clean - - python3.9 -m pip install --upgrade pip - python3.9 -m pip install pipenv virtualenv - # build context - mkdir /build-ctx && cd /build-ctx +%files + env.d/blender-3.6.3-linux-x64.tar.xz /build-ctx/ - # Setup blender - # wget "https://yale.box.com/shared/static/nn6n5iyo5m4tzl5u9yoy2dvv1ohk22xj.xz" \ - # -O blender.tar.gz - # tar -xf blender.tar.gz - # mv blender-2.* "/usr/local/blender" - # chmod +x "/usr/local/blender/blender" - # Set up Julia - JURL="https://julialang-s3.julialang.org/bin/linux/x64/1.8/julia-1.8.5-linux-x86_64.tar.gz" - wget "$JURL" -O "julia.tar.gz" - tar -xzf "julia.tar.gz" -C "/usr/local/" - chmod +x /usr/local/julia-1.8.5/bin/* +%post + cd /build-ctx + # blender + apt-get install -y libsm6 libxext6 + tar -xf "blender-3.6.3-linux-x64.tar.xz" + mv blender-3.6.3-linux-x64 "/usr/local/blender" + chmod +x "/usr/local/blender/blender" # clean up rm -rf /build-ctx - - # Add an sbatch workaround - echo '#!/bin/bash\nssh -y "$HOSTNAME" sbatch "$@"' > /usr/bin/sbatch - chmod +x /usr/bin/sbatch - - # Add an scancel workaround - echo '#!/bin/bash\nssh -y "$HOSTNAME" scancel "$@"' > /usr/bin/scancel - chmod +x /usr/bin/scancel - - # Add an srun workaround - echo '#!/bin/bash\nssh -y "$HOSTNAME" srun "$@"' > /usr/bin/srun - chmod +x /usr/bin/srun diff --git a/scripts/stimuli/generate_rooms.jl b/scripts/stimuli/generate_rooms.jl index 2fbedf6..cfa9781 100644 --- a/scripts/stimuli/generate_rooms.jl +++ b/scripts/stimuli/generate_rooms.jl @@ -8,33 +8,32 @@ using WaveFunctionCollapse function prop_weights() n = length(HT2D_vec) - ws = zeros(n, n) # column `i` in `ws` defines the weights over # h-tiles (the rows) associated with `i`. - + ws = zeros(n, n) # Want mostly empty space - ws[1, :] .= 1.0 # - - # Add "islands" - ws[2:end, 1] .= 0.7 - + ws[1, :] .= 25.0 # + # Add "islands" proportional to size + # ws[2:end, 1] .= 20 + for (i, hti) = enumerate(HT2D_vec) + ws[i, 1] += 10.0 * count(hti) + end # Grow islands with smaller parts for (i, hti) = enumerate(HT2D_vec) ni = count(hti) - ni < 2 && continue + # ni < 2 && continue for (j, htj) = enumerate(HT2D_vec) nj = count(htj) - nj >= ni && continue - ws[j, i] += 10 * ((hti[3] == htj[1]) && (hti[4] == htj[2])) * - (1.0 / (nj+1)^2) + (nj == 0 || nj >= ni) && continue + ws[j, i] += 6 * (4 - nj) * + ((hti[3] == htj[1]) || (hti[4] == htj[2])) end end - return ws end function room_to_template(r::GridRoom; - gap::Int64 = 2) + gap::Int64 = 1) d = data(r) walls = d .== wall_tile y, x = size(d) @@ -62,8 +61,7 @@ end function sample_obstacles(template::AbstractMatrix{Int64}, pr::Matrix{Float64}) - tmp = zeros(Int64, size(template)) - ws = WaveState(tmp, pr) + ws = WaveState(template, pr) collapse!(ws, pr) # empty out original walls ws.wave[template .!= 0] .= 1 @@ -90,7 +88,7 @@ end function analyze_path(room::GridRoom, params::PathProcedure) path, _... = path_procedure(room, params) - d = FunctionalScenes.obstacle_diffusion(room, path, 0.2, 10) + d = FunctionalScenes.obstacle_diffusion(room, path, 0.5, 5) end function eval_pair(left_door::GridRoom, right_door::GridRoom, @@ -101,22 +99,18 @@ function eval_pair(left_door::GridRoom, right_door::GridRoom, diff_right = analyze_path(right_door, path_params) fs = furniture(left_door) - candidates = falses(length(fs)) - for (fi, f) in enumerate(fs) - candidates[fi] = - length(f) < 4 && - diff_left[fi] < 1.0 && - diff_right[fi] > 5.0 + candidates = Vector{Bool}(undef, length(fs)) + @inbounds for (fi, f) in enumerate(fs) + candidates[fi] = diff_left[fi] < 0.1 && + diff_right[fi] > 3.0 end - - # pick a random candidate - length(fs) > 3 && any(candidates) ? rand(findall(candidates)) : 0 + length(fs) > 3 && any(candidates) ? rand(findall(candidates)) : 0 end function main() - name = "diffusion_09_18_2023" + name = "diffusion_n_block" dataset_out = "/spaths/datasets/$(name)" isdir(dataset_out) || mkdir(dataset_out) @@ -138,7 +132,7 @@ function main() kernel_width = 3) # number of trials - n = 1 + n = 15 # empty room with doors left_cond = empty_room(room_steps, room_bounds, entrance, [doors[1]]) diff --git a/scripts/stimuli/render_rooms.jl b/scripts/stimuli/render_rooms.jl index 6130f36..65d5ccf 100644 --- a/scripts/stimuli/render_rooms.jl +++ b/scripts/stimuli/render_rooms.jl @@ -4,28 +4,37 @@ using FileIO using ArgParse using DataFrames using FunctionalScenes +using FunctionalScenes: render_mitsuba +using Images:colorview, RGB cycles_args = Dict( :mode => "full", # :mode => "none", :navigation => false, - :template => "/spaths/datasets/vss_template.blend" + :template => "/spaths/datasets/vss_template.blend", ) +function load_from_disk(path::String) + local base_s + open(path, "r") do f + base_s = JSON.parse(f) + end + from_json(GridRoom, base_s) +end + function render_stims(df::DataFrame, name::String; threads = Sys.CPU_THREADS) out = "/spaths/datasets/$(name)/render_cycles" isdir(out) || mkdir(out) for r in eachrow(df), door = 1:2 base_p = "/spaths/datasets/$(name)/scenes/$(r.scene)_$(door).json" - local base_s - open(base_p, "r") do f - base_s = JSON.parse(f) - end - base = from_json(GridRoom, base_s) + base = load_from_disk(base_p) p = "$(out)/$(r.scene)_$(door)" + # original room render(base, p; cycles_args...) + + # removed one obstacle cluster f = furniture(base)[r.fidx] rem = remove(base, f) p = "$(out)/$(r.scene)_$(door)_removed" @@ -35,7 +44,7 @@ function render_stims(df::DataFrame, name::String; end function main() - cmd = ["diffusion_09_18_2023", "0"] + cmd = ["diffusion_n_block", "0"] args = parse_commandline(;x=cmd) name = args["dataset"] @@ -50,7 +59,7 @@ function main() end render_stims(df, name, - threads = args["threads"] + threads = args["threads"], ) return nothing end diff --git a/src/blender/blender.jl b/src/blender/blender.jl index 8f47f93..493a255 100644 --- a/src/blender/blender.jl +++ b/src/blender/blender.jl @@ -6,7 +6,7 @@ const obstacle_height = 0.3 * tile_height function light(pos) Dict(:position => [pos..., 0.95 * tile_height], :orientation => [0., 0., 0.5 * pi], - :intensity => 150.0) + :intensity => 100.0) end function lights(r::Room) diff --git a/src/blender/render.py b/src/blender/render.py index b55cc80..725f03b 100644 --- a/src/blender/render.py +++ b/src/blender/render.py @@ -186,7 +186,7 @@ def set_rendering_params(self, resolution): bpy.context.scene.render.resolution_x = resolution[0] bpy.context.scene.render.resolution_y = resolution[1] bpy.context.scene.render.resolution_percentage = 100 - bpy.context.scene.render.engine = 'CYCLES' + # bpy.context.scene.render.engine = 'CYCLES' # bpy.context.scene.render.engine = 'BLENDER_EEVEE' # bpy.context.scene.cycles.samples = 128 # bpy.context.scene.render.tile_x = 16 @@ -244,8 +244,8 @@ def render(self, output_name, resolution , camera_rot = None): :type camera_rot: float """ - if not (resolution is None): - self.set_rendering_params(resolution) + # if not (resolution is None): + # self.set_rendering_params(resolution) if os.path.isfile(output_name): print('File {0!s} exists'.format(output_name)) @@ -255,8 +255,10 @@ def render(self, output_name, resolution , camera_rot = None): t0 = time.time() print('Rendering ') sys.stdout.flush() + # hide blender output with Suppressor(): bpy.ops.render.render(write_still=True) + bpy.ops.render.render(write_still=True) print('Rendering took {}s'.format(time.time() - t0)) sys.stdout.flush() @@ -332,14 +334,19 @@ def main(): scene = Scene(args.scene) - if args.gpu: - print('Using gpu') - bpy.context.scene.cycles.device = 'GPU' + # if args.gpu: + # print('Using gpu') + # bpy.context.scene.cycles.device = 'GPU' path = os.path.join(args.out, 'render') if not os.path.isdir(path): os.mkdir(path) + for s in bpy.data.scenes: + s.cycles.device = 'GPU' + + bpy.context.scene.cycles.device = 'GPU' + # bpy.ops.render.render(True) if args.mode == 'full': p = args.out + '.png' diff --git a/src/dgp/path_based/path_cost.jl b/src/dgp/path_based/path_cost.jl index 2c64d10..99620a9 100644 --- a/src/dgp/path_based/path_cost.jl +++ b/src/dgp/path_based/path_cost.jl @@ -249,6 +249,7 @@ function obstacle_diffusion(room::GridRoom, @inbounds for v in f result[fi] += m[v] end + result[fi] *= 1.0 / length(f) end return result end diff --git a/test/graphics/mitsuba_volume.py b/test/graphics/mitsuba_volume.py index 77f9093..2b27b20 100644 --- a/test/graphics/mitsuba_volume.py +++ b/test/graphics/mitsuba_volume.py @@ -11,7 +11,7 @@ def main(): mi.set_variant('cuda_ad_rgb') - dimensions = [32, 32, 5] + dimensions = [16, 16, 5] door = [10, -8] res = (128, 128) # res = (120, 180) @@ -22,7 +22,7 @@ def main(): scene = mi.load_dict(d) key = 'object.interior_medium.sigma_t.data' params = mi.traverse(scene) - params[key] = np.random.rand(1, 32, 32, 1) + params[key] = np.random.rand(1, 16, 16, 1) params.update() # print(params) start_time = time.time()