This is a tensorpack.dataflow based data generator that takes a pandas DataFrame as input. The DataFrame has one or more columns that act as path components and a label column.
- path_func:
This function takes a pandas DataFrame row as an input and generates corresponding image path.
df = DFBaseDataFlow(df=data_frame,
path_func=lambda row: (base_path + row.filename),
label_column='class',
resize=(224, 224))
generator = df.get_data()
df = DFBaseDataFlow(df=data_frame,
path_func=lambda row: (base_path + row.filename),
label_column='class',
resize=(224, 224))
df1 = BatchData(df, 32)
df2 = PrefetchData(df1, nr_prefetch=4, nr_proc=1)
generator = df2.get_data()