Datasette

Some utilities to handle datasets uploaded to my datasette

Open In Colab

Compatibility Block

Check Platform

IN_COLAB = 'google.colab' in sys.modules
IN_KAGGLE = 'kaggle_secrets' in sys.modules
IS_REMOTE = IN_COLAB or IN_KAGGLE

Platform & Environment Configuration

Imports

Public Imports

Private Imports


source

get_image_df

 get_image_df (path, csvfile='image.csv', rel_path_col='rel_path',
               folder_col='label', fname_col='fn', skip_col=None)

source

get_images_from_df

 get_images_from_df (path, df=None, rel_path_col='rel_path')
df = get_image_df(path)
# df = get_image_df(path, csvfile='cleaned_v1.csv', skip_col='skipped'); len(df)
get_images_from_df(path, df=df)
(#309) [Path('/mnt/d/rahuketu/programming/AIKING_HOME/data/PandemicSafety/No_Mask/7a8b0909-4f5c-4d53-b1bc-f35a83a022c9.jpg'),Path('/mnt/d/rahuketu/programming/AIKING_HOME/data/PandemicSafety/No_Mask/1f54d9ac-4a0e-42fe-98cb-09938a3104b0.jpg'),Path('/mnt/d/rahuketu/programming/AIKING_HOME/data/PandemicSafety/No_Mask/d08a498f-27cf-4668-a4f1-af32dfd15416.jpg'),Path('/mnt/d/rahuketu/programming/AIKING_HOME/data/PandemicSafety/No_Mask/52601346-132e-4217-ab57-6c324c1e4eee.jpg'),Path('/mnt/d/rahuketu/programming/AIKING_HOME/data/PandemicSafety/No_Mask/78ac55fb-2db3-48e9-bdcc-4caa2a50e3f6.jpg'),Path('/mnt/d/rahuketu/programming/AIKING_HOME/data/PandemicSafety/No_Mask/5eeec12d-174e-4d1d-a261-8dcd99ea9b8b.jpg'),Path('/mnt/d/rahuketu/programming/AIKING_HOME/data/PandemicSafety/No_Mask/f048f38a-3758-428d-8d9f-8462a4e272d0.jpeg'),Path('/mnt/d/rahuketu/programming/AIKING_HOME/data/PandemicSafety/No_Mask/cfbe3224-4ec8-47f6-8ee8-d637572b2787.jpg'),Path('/mnt/d/rahuketu/programming/AIKING_HOME/data/PandemicSafety/No_Mask/b2b14d80-ddf9-4e4a-9b61-afdbabb1cf9d.jpg'),Path('/mnt/d/rahuketu/programming/AIKING_HOME/data/PandemicSafety/No_Mask/d7a7b4e3-4756-4294-88d6-6c23a7ba6741.jpg')...]

source

get_y_df

 get_y_df (o, path=None, df=None, label_col='label',
           rel_path_col='rel_path')

source

get_new_dataset

 get_new_dataset (df, mods, join_col='fn', skip_col='skipped',
                  new_label_col='new_label', old_label_col='label')
o = get_images_from_df(path, df=df)[0]; (o, str(o.relpath(path)))
get_y_df(o, path=path, df=df)
'No_Mask'