-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cdc56f0
commit 8dc7928
Showing
2 changed files
with
35 additions
and
8 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import numpy as np | ||
import torch | ||
|
||
from torch_subpixel_crop import subpixel_crop_2d | ||
from skimage import data | ||
|
||
image = torch.tensor(data.binary_blobs(length=512, n_dim=2)).float() | ||
positions = torch.tensor(np.random.uniform(low=0, high=511, size=(100, 2))).float() | ||
|
||
crops = subpixel_crop_2d( | ||
image=image, | ||
positions=positions, | ||
sidelength=32 | ||
) | ||
|
||
# (100, 32, 32) | ||
print(crops.shape) |
This file contains 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