FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Avoid sampling of NaN center location by jeylau · Pull Request #2037 · DeepLabCut/DeepLabCut · GitHub

Avoid sampling of NaN center location - #2037

Merged
MMathisLab merged 1 commit into
masterfrom
finite_crop_center
Nov 7, 2022
Merged

Avoid sampling of NaN center location#2037
MMathisLab merged 1 commit into
masterfrom
finite_crop_center

Conversation

jeylau commented Nov 7, 2022

Copy link
Copy Markdown
Contributor

In #1946, np.full(..., np.nan) is required in order for FlipLR to work when keypoints are hidden. Occasionally though, a NaN point can be sampled as crop center

kpts = batch.keypoints[n].to_xy_array()
n_kpts = kpts.shape[0]
inds = np.arange(n_kpts)
if sampling == "density":
# Points located close to one another are sampled preferentially
# in order to augment crowded regions.
radius = 0.1 * min(h, w)
n_neighbors = self.calc_n_neighbors(kpts, radius)
# Include keypoints in the count to avoid null probabilities
n_neighbors += 1
p = n_neighbors / n_neighbors.sum()
else:
p = np.ones_like(inds) / n_kpts
center = kpts[random_state.choice(inds, p=p)]
causing imgaug errors.
This one-liner addresses this bug.

jeylau added the bug fix! fix for a real buggy one... label Nov 7, 2022
jeylau requested review from AlexEMG and MMathisLab November 7, 2022 12:39
MMathisLab merged commit 81244bd into master Nov 7, 2022
jeylau deleted the finite_crop_center branch November 8, 2022 08:44
biol-jsh added a commit to biol-jsh/DeepLabCut that referenced this pull request Nov 10, 2022
The current implementation of fliplr breaks when keypoints are hidden since only labels for visible points are forwarded to the pipeline. This is the second attempt at fixing this as an earlier attempt failed due to the error fixed in PR DeepLabCut#2037.
jonahpearl pushed a commit to jonahpearl/DeepLabCut that referenced this pull request Nov 27, 2022
MMathisLab pushed a commit that referenced this pull request Oct 27, 2023
* Fix fliplr augmentation for multi animal 2

The current implementation of fliplr breaks when keypoints are hidden since only labels for visible points are forwarded to the pipeline. This is the second attempt at fixing this as an earlier attempt failed due to the error fixed in PR #2037.

* added missing batch_joints append from DLC PR 1946

* made same changes to get_batch_from_video as get_batch. style fixes.

* Fix indices when training with identity

* Fix and expand unit tests

---------

Co-authored-by: Niels Poulsen <niels.poulsen@epfl.ch>
Co-authored-by: Jessy Lauer <30733203+jeylau@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug fix! fix for a real buggy one...

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL