Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sync roost counting changes with Canadian data #2

Open
wants to merge 23 commits into
base: tnmy/canadian_latest
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
bb371f7
minor updates to experiments_v3_linear_adaptor
wenlongzhao094 Aug 11, 2023
7c6fcc1
experiment_v4_maskrcnn
wenlongzhao094 Aug 11, 2023
002b976
count birds and bats, half done feature
wenlongzhao094 Aug 11, 2023
f9f6744
tools: README, post_hoc_counting
wenlongzhao094 Sep 3, 2023
3ad1457
counting animals in deployment
wenlongzhao094 Sep 23, 2023
a8a35ee
counting animals in deployment
wenlongzhao094 Sep 23, 2023
a7f5762
delete scans if no successfully rendered arrays
wenlongzhao094 Sep 24, 2023
0d7e644
add counting to run_day_station, yet to test
wenlongzhao094 Dec 31, 2023
4056fd5
pilot run
wenlongzhao094 Jan 19, 2024
604de62
debug counting in the system
wenlongzhao094 Jan 20, 2024
2d33620
vectorize
wenlongzhao094 Jan 23, 2024
5748db8
automate output file transfer
wenlongzhao094 Jan 26, 2024
9533887
count bats
wenlongzhao094 Feb 11, 2024
4f07081
config and launch
wenlongzhao094 Feb 28, 2024
424530d
no longer need publish_images.sh
wenlongzhao094 Mar 22, 2024
d492a76
Fix track_id in sweeps to ease the merge of per-sweep counts with scr…
wenlongzhao094 Apr 22, 2024
8e38e58
bug fix in post_hoc_counting/count_texas_bats_v3
wenlongzhao094 Apr 22, 2024
26b7252
post-hoc count bats w/ dualpol and dBZ filtering
wenlongzhao094 Jun 12, 2024
07cbc72
add counting with dualpol and reflectivity thresholds to deployment
wenlongzhao094 Jun 13, 2024
6051131
counting config
wenlongzhao094 Jun 14, 2024
2603ae2
debugging improved rsync
wenlongzhao094 Aug 11, 2024
e5410ad
us_sunrise_v3_debug in progress
wenlongzhao094 Aug 18, 2024
9cdfd7e
ready for us deployment, counting and auto result transfer
wenlongzhao094 Aug 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
debug counting in the system
  • Loading branch information
wenlongzhao094 committed Jan 20, 2024
commit 604de6214e1452a4f9a210139262307cec222829
4 changes: 2 additions & 2 deletions src/roosts/system.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,8 @@ def run_day_station(

# save the list of tracks for UI, also save the list of sweeps and their animal counts
self.visualizer.count_and_save(
cleaned_detections, tracks, self.count_cfg,
tracks_path, sweeps_path
cleaned_detections, tracks, self.postprocess.geosize, self.count_cfg,
self.dirs["scan_dir"], scanname2key, tracks_path, sweeps_path
)
delete_files([os.path.join(self.dirs["scan_dir"], key) for key in keys])

Expand Down
2 changes: 1 addition & 1 deletion src/roosts/utils/counting_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def xyr2geo(x, y, r, dim=600, rmax=150000, k=1.0):
x0 = y0 = dim / 2.0 # origin
x = (x - x0) * 2 * rmax / dim
y = -(y - y0) * 2 * rmax / dim
r = r * 2 * k * rmax / dim # TODO: scaling by k may cause the r to be larger than the scope
r = r * k * 2 * rmax / dim # TODO: scaling by k may cause the r to be larger than the scope

return (x, y, r)

Expand Down
13 changes: 8 additions & 5 deletions src/roosts/utils/visualizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,10 @@ def save_gif(self, image_paths, outpath):
imageio.mimsave(outpath, seq, "GIF", **kargs)


def count_and_save(self, detections, tracks, count_cfg, tracks_path, sweeps_path):
def count_and_save(
self, detections, tracks, geosize, count_cfg,
scan_dir, scanname2key, tracks_path, sweeps_path
):
"""Save the list of tracks for UI, also save the list of sweeps and their animal counts"""
det_dict = {}
for det in detections:
Expand Down Expand Up @@ -303,7 +306,7 @@ def count_and_save(self, detections, tracks, count_cfg, tracks_path, sweeps_path
xyr = xyr2geo(
det["im_bbox"][0], det["im_bbox"][1], det["im_bbox"][2],
k=count_cfg["count_scaling"]
)
) # geometric offset to radar
det["geo_dist"] = (xyr[0] ** 2 + xyr[1] ** 2) ** 0.5

f.write(
Expand All @@ -324,7 +327,7 @@ def count_and_save(self, detections, tracks, count_cfg, tracks_path, sweeps_path
with open(sweeps_path, 'a+') as ff:
# loop over sweeps, credit to Maria C. T. D. Belotti
radar = pyart.io.read_nexrad_archive(
os.path.join(self.dirs["scan_dir"], scanname2key[det["scanname"]])
os.path.join(scan_dir, scanname2key[det["scanname"]])
)
try:
sweep_indexes, sweep_angles = get_unique_sweeps(radar)
Expand All @@ -344,10 +347,10 @@ def count_and_save(self, detections, tracks, count_cfg, tracks_path, sweeps_path
ff.write(
",".join([
f"{det['track_ID']:d}", det["scanname"],
sweep_idx, f"{sweep_angle:.3f}",
f"{sweep_index}", f"{sweep_angle:.3f}",

f"{count_cfg['count_scaling']:.3f}",
n_roost_pixels, n_overthresh_pixels, f"{n_animals:.3f}"
f"{n_roost_pixels}", f"{n_overthresh_pixels}", f"{n_animals:.3f}"
]) + "\n"
)
except:
Expand Down
17 changes: 9 additions & 8 deletions tools/launch_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@
# TIMES = [(f"{year}0601", f"{year}1031") for year in range(2000, 2023)]
# or
STATIONS_TIMES = [
("KTYX", "20200101", "20201231"),
("KTYX", "20220101", "20221231"),
("KLIX", "20200101", "20201231"),
("KLIX", "20220101", "20221231"),
("KDAX", "20200101", "20201231"),
("KDAX", "20220101", "20221231"),
("KTLX", "20200101", "20201231"),
("KTLX", "20220101", "20221231"),
("KTYX", "20200805", "20200806"),
# ("KTYX", "20200101", "20201231"),
# ("KTYX", "20220101", "20221231"),
# ("KLIX", "20200101", "20201231"),
# ("KLIX", "20220101", "20221231"),
# ("KDAX", "20200101", "20201231"),
# ("KDAX", "20220101", "20221231"),
# ("KTLX", "20200101", "20201231"),
# ("KTLX", "20220101", "20221231"),
]

SPECIES = "swallow"
Expand Down