Functions that prepare label files and split the data into train validation and test sets
Imports¶
Typical Usage¶
Imports
Define directories
get stats on images
Well Croping & Resizing link to another section
Convert directory of CSV files to JSON files link to another section
Resize jpg & json files link to another section
Create label png images based on Json files and store in dest directory") link to another section
Split into Train, Val and Test link to another section
Save label files without color pallet info link to another section
Test Create DataBunch link to another section
Show example images link to another section
Default Class Labels¶
Well Croping & Resizing¶
Pandas and CSV¶
Other¶
This function creates two markup up files
jdata = json.load(open(TEST_JSON))
img = np_open_image(TEST_JPG)
img, lab_img, num_points, label_cnt_dict = make_label_img_from_json(jdata, img, radius=20)
plot_images({'RGB':img, 'P':lab_img}, figsize=(12, 5))
lab_img.shape
sav_pil = PIL.Image.fromarray(lab_img.astype(np.uint8), mode='P')
sav_pil.putpalette(LABEL_COLORMAP)
fn = Path(TEST_JPG)
sav_pil.save(TEST_PNG)
load_pil = np_open_image(TEST_PNG)
show_img(np_open_image(TEST_PNG))
print(lab_img.min(), lab_img.max())
if IN_IPYTHON:
img = np_open_image(TEST_JPG)
data = json.load(open(TEST_JSON))
data = json.load(open('nbs_test_data/235443 - 1.json'))
create_one_label(TEST_JPG, TEST_PATH, TEST_PATH, LABEL_COLORMAP)
TEST_PATH
from cellsegment.core import *
# TEST_PATH