feat: fuck yeah

Former-commit-id: d472cf758e1761df9f15d1f5c7448cc4274d089f [formerly 4cd21f3ca4f0e8e22f22f61ac76e5ed4478e6937]
Former-commit-id: 9b2b0d5dd11d7b7804b1e64d52fcff2d2ea43a0b
This commit is contained in:
Laurent Fainsin 2022-07-07 13:40:00 +02:00
parent 0dd606144f
commit 92058da1d5
4 changed files with 7 additions and 22 deletions

View file

@ -1 +1 @@
3c9a34f197340a6051eb34d11695c7d6b72164f0 5ef2ef54312186cd3e3162869c4f237b69de3b1e

View file

@ -13,13 +13,12 @@ CONFIG = {
"DIR_TRAIN_IMG": "/home/lilian/data_disk/lfainsin/train/", "DIR_TRAIN_IMG": "/home/lilian/data_disk/lfainsin/train/",
"DIR_VALID_IMG": "/home/lilian/data_disk/lfainsin/val/", "DIR_VALID_IMG": "/home/lilian/data_disk/lfainsin/val/",
"DIR_TEST_IMG": "/home/lilian/data_disk/lfainsin/test/", "DIR_TEST_IMG": "/home/lilian/data_disk/lfainsin/test/",
"DIR_SPHERE_IMG": "/home/lilian/data_disk/lfainsin/spheres/Images/", "DIR_SPHERE": "/home/lilian/data_disk/lfainsin/spheres_prod/",
"DIR_SPHERE_MASK": "/home/lilian/data_disk/lfainsin/spheres/Masks/",
# "FEATURES": [1, 2, 4, 8], # "FEATURES": [1, 2, 4, 8],
# "FEATURES": [4, 8, 16, 32], # "FEATURES": [4, 8, 16, 32],
# "FEATURES": [8, 16, 32, 64], "FEATURES": [8, 16, 32, 64],
# "FEATURES": [4, 8, 16, 32, 64], # "FEATURES": [4, 8, 16, 32, 64],
"FEATURES": [8, 16, 32, 64, 128], # "FEATURES": [8, 16, 32, 64, 128],
# "FEATURES": [16, 32, 64, 128], # "FEATURES": [16, 32, 64, 128],
# "FEATURES": [64, 128, 256, 512], # "FEATURES": [64, 128, 256, 512],
"N_CHANNELS": 3, "N_CHANNELS": 3,

View file

@ -73,7 +73,7 @@ class UNet(pl.LightningModule):
A.Resize(wandb.config.IMG_SIZE, wandb.config.IMG_SIZE), A.Resize(wandb.config.IMG_SIZE, wandb.config.IMG_SIZE),
A.Flip(), A.Flip(),
A.ColorJitter(), A.ColorJitter(),
RandomPaste(wandb.config.SPHERES, wandb.config.DIR_SPHERE_IMG, wandb.config.DIR_SPHERE_MASK), RandomPaste(wandb.config.SPHERES, wandb.config.DIR_SPHERE),
A.GaussianBlur(), A.GaussianBlur(),
A.ISONoise(), A.ISONoise(),
A.ToFloat(max_value=255), A.ToFloat(max_value=255),

View file

@ -1,4 +1,3 @@
import os
import random as rd import random as rd
from pathlib import Path from pathlib import Path
@ -75,20 +74,10 @@ class RandomPaste(A.DualTransform):
mask_path = img_path.parent.joinpath("MASK.PNG") mask_path = img_path.parent.joinpath("MASK.PNG")
# load the "paste" image # load the "paste" image
paste_img = Image.open( paste_img = Image.open(img_path).convert("RGBA")
os.path.join(
self.path_paste_img_dir,
img_path,
)
).convert("RGBA")
# load its respective mask # load its respective mask
paste_mask = Image.open( paste_mask = Image.open(mask_path).convert("LA")
os.path.join(
self.path_paste_mask_dir,
mask_path,
)
).convert("LA")
# load the target image # load the target image
target_img = params["image"] target_img = params["image"]
@ -151,6 +140,3 @@ class RandomPaste(A.DualTransform):
) )
return params return params
def get_transform_init_args_names(self):
return "scale_range", "path_paste_img_dir", "path_paste_mask_dir"