feat: some minor optimizations

Former-commit-id: 11b12e40034014a428ed542c9c1b9a89e7989b9f [formerly 8206accd8de41ce6261d30f139823804f908f35b]
Former-commit-id: 2cf3e549e6829802a8663ceab1e24ad0e7495018
This commit is contained in:
Laurent Fainsin 2022-07-10 17:29:50 +02:00
parent 8d903e7ad1
commit 8630f1c583
5 changed files with 1577 additions and 1881 deletions

3441
poetry.lock generated

File diff suppressed because it is too large Load diff

View file

@ -18,6 +18,7 @@ torch = "^1.11.0"
torchvision = "^0.12.0" torchvision = "^0.12.0"
tqdm = "^4.64.0" tqdm = "^4.64.0"
wandb = "^0.12.19" wandb = "^0.12.19"
Pillow-SIMD = "^9.0.0"
[tool.poetry.dev-dependencies] [tool.poetry.dev-dependencies]
black = "^22.3.0" black = "^22.3.0"

View file

@ -1 +1 @@
ac8ff07f541ae6d7cba729b20e0d04654c6018c9 e7aad782356a06d40585b15274e7aeed664b2c03

View file

@ -30,6 +30,7 @@ class Spheres(pl.LightningDataModule):
return DataLoader( return DataLoader(
dataset, dataset,
shuffle=True, shuffle=True,
prefetch_factor=8,
batch_size=wandb.config.BATCH_SIZE, batch_size=wandb.config.BATCH_SIZE,
num_workers=wandb.config.WORKERS, num_workers=wandb.config.WORKERS,
pin_memory=wandb.config.PIN_MEMORY, pin_memory=wandb.config.PIN_MEMORY,
@ -43,6 +44,7 @@ class Spheres(pl.LightningDataModule):
dataset, dataset,
shuffle=False, shuffle=False,
batch_size=1, batch_size=1,
prefetch_factor=8,
num_workers=wandb.config.WORKERS, num_workers=wandb.config.WORKERS,
pin_memory=wandb.config.PIN_MEMORY, pin_memory=wandb.config.PIN_MEMORY,
) )

View file

@ -63,12 +63,12 @@ class RandomPaste(A.DualTransform):
angle=angle, angle=angle,
translate=(0, 0), translate=(0, 0),
shear=(shearx, sheary), shear=(shearx, sheary),
interpolation=T.InterpolationMode.BICUBIC, interpolation=T.InterpolationMode.BILINEAR,
) )
paste_img = T.functional.resize( paste_img = T.functional.resize(
paste_img, paste_img,
size=shape, size=shape,
interpolation=T.InterpolationMode.BICUBIC, interpolation=T.InterpolationMode.BILINEAR,
) )
paste_mask = T.functional.affine( paste_mask = T.functional.affine(
@ -77,12 +77,12 @@ class RandomPaste(A.DualTransform):
angle=angle, angle=angle,
translate=(0, 0), translate=(0, 0),
shear=(shearx, sheary), shear=(shearx, sheary),
interpolation=T.InterpolationMode.BICUBIC, interpolation=T.InterpolationMode.BILINEAR,
) )
paste_mask = T.functional.resize( paste_mask = T.functional.resize(
paste_mask, paste_mask,
size=shape, size=shape,
interpolation=T.InterpolationMode.BICUBIC, interpolation=T.InterpolationMode.BILINEAR,
) )
img.paste(paste_img, (x, y), paste_mask) img.paste(paste_img, (x, y), paste_mask)
@ -103,12 +103,12 @@ class RandomPaste(A.DualTransform):
angle=angle, angle=angle,
translate=(0, 0), translate=(0, 0),
shear=(shearx, sheary), shear=(shearx, sheary),
interpolation=T.InterpolationMode.BICUBIC, interpolation=T.InterpolationMode.BILINEAR,
) )
paste_mask = T.functional.resize( paste_mask = T.functional.resize(
paste_mask, paste_mask,
size=shape, size=shape,
interpolation=T.InterpolationMode.BICUBIC, interpolation=T.InterpolationMode.BILINEAR,
) )
# binarize the mask -> {0, 1} # binarize the mask -> {0, 1}