EmaadKhwaja
commited on
Commit
·
0677b2b
1
Parent(s):
3b0e324
update dataloader
Browse files- dataloader.py +0 -20
dataloader.py
CHANGED
|
@@ -9,10 +9,7 @@ from torch.utils.data import Dataset
|
|
| 9 |
from torchvision import transforms
|
| 10 |
import torchvision.transforms.functional as TF
|
| 11 |
|
| 12 |
-
<<<<<<< HEAD
|
| 13 |
from celle.utils import replace_outliers
|
| 14 |
-
=======
|
| 15 |
-
>>>>>>> 5d2263b456a117f5f8e81f9c45af75748d5a2c3d
|
| 16 |
|
| 17 |
def simple_conversion(seq):
|
| 18 |
"""Create 26-dim embedding"""
|
|
@@ -59,23 +56,6 @@ def simple_conversion(seq):
|
|
| 59 |
return torch.tensor([seqs_x]).long()
|
| 60 |
|
| 61 |
|
| 62 |
-
<<<<<<< HEAD
|
| 63 |
-
=======
|
| 64 |
-
def replace_outliers(image, percentile=0.0001):
|
| 65 |
-
|
| 66 |
-
lower_bound, upper_bound = torch.quantile(image, percentile), torch.quantile(
|
| 67 |
-
image, 1 - percentile
|
| 68 |
-
)
|
| 69 |
-
mask = (image <= upper_bound) & (image >= lower_bound)
|
| 70 |
-
|
| 71 |
-
valid_pixels = image[mask]
|
| 72 |
-
|
| 73 |
-
image[~mask] = torch.clip(image[~mask], min(valid_pixels), max(valid_pixels))
|
| 74 |
-
|
| 75 |
-
return image
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
>>>>>>> 5d2263b456a117f5f8e81f9c45af75748d5a2c3d
|
| 79 |
class CellLoader(Dataset):
|
| 80 |
"""imports mined opencell images with protein sequence"""
|
| 81 |
|
|
|
|
| 9 |
from torchvision import transforms
|
| 10 |
import torchvision.transforms.functional as TF
|
| 11 |
|
|
|
|
| 12 |
from celle.utils import replace_outliers
|
|
|
|
|
|
|
| 13 |
|
| 14 |
def simple_conversion(seq):
|
| 15 |
"""Create 26-dim embedding"""
|
|
|
|
| 56 |
return torch.tensor([seqs_x]).long()
|
| 57 |
|
| 58 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
class CellLoader(Dataset):
|
| 60 |
"""imports mined opencell images with protein sequence"""
|
| 61 |
|