def __getitem__(self, index):
     item = self.records[index]
     img = rio.load_site(item.dataset, item.experiment, item.plate, item.well, item.site, base_path=self.root)
     label = item.sirna if self.mode == 'train' else item.id_code
     out = self.transform(img, item.experiment)
     if self.with_plates:
         p = torch.zeros(4, dtype=torch.float32)
         p[item.plate - 1] = 1.0
         out = out, p
     
     return out, label
Esempio n. 2
0
def load_image(row):
    images = []
    for site in [1, 2]:
        image = rio.load_site('train',
                              row['experiment'],
                              row['plate'],
                              row['well'],
                              site,
                              base_path=row['root'])
        images.append(image)

    images = np.stack(images, 0)

    return images
# In[12]:


md['site'].value_counts()


# <strong>Image</strong>

# In[13]:


# pixel_stats.csv
# row 1-6
# train set, experiment HEPG2-01, plate 1, well B02, site 1

t = rio.load_site('train', 'HEPG2-01', 1, 'B02', 1, base_path=LOCAL_IMAGES_BASE_PATH)

t.shape


# In[14]:


img = t[:, :, 0]  # channel 1

img.shape


# In[15]:

# In[3]:

# Ref:
#     rxrx/io.py, line: 14, 15

LOCAL_IMAGES_BASE_PATH = 'D:\\_peng\\recursion-cellular-image-classification'  # windows
DEFAULT_METADATA_BASE_PATH = LOCAL_IMAGES_BASE_PATH

# In[4]:

# train set, experiment RPE-05, plate 3, well D19, site 2

t = rio.load_site('train',
                  'RPE-05',
                  3,
                  'D19',
                  2,
                  base_path=LOCAL_IMAGES_BASE_PATH)

t.shape

# In[5]:

fig, axes = plt.subplots(2, 3, figsize=(24, 16))

for i, ax in enumerate(axes.flatten()):
    ax.axis('off')
    ax.set_title('channel {}'.format(i + 1))
    _ = ax.imshow(t[:, :, i], cmap='gray')

# In[6]:
Esempio n. 5
0
import numpy as np  # linear algebra
import pandas as pd  # data processing, CSV file I/O (e.g. pd.read_csv)
import os
print(os.listdir("../input"))
import sys
import matplotlib.pyplot as plt
### matplotlib inline
### git clone https://github.com/recursionpharma/rxrx1-utils
print('rxrx1-utils cloned!')
### ls
sys.path.append('rxrx1-utils')
import rxrx.io as rio
t = rio.load_site('train', 'RPE-05', 3, 'D19', 2)
t.shape
fig, axes = plt.subplots(2, 3, figsize=(24, 16))

for i, ax in enumerate(axes.flatten()):
    ax.axis('off')
    ax.set_title('channel {}'.format(i + 1))
    _ = ax.imshow(t[:, :, i], cmap='gray')
x = rio.convert_tensor_to_rgb(t)
x.shape
plt.figure(figsize=(8, 8))
plt.axis('off')

_ = plt.imshow(x)
y = rio.load_site_as_rgb('train', 'HUVEC-08', 4, 'K09', 1)

plt.figure(figsize=(8, 8))
plt.axis('off')