Integrate image and tabular data for deep learning
Project description
image_tabular
Integrate image and tabular data for deep learning.
Install
pip install image_tabular
How to use
This library utilizes fastai and pytorch to integrate image and tabular data for deep learning and train a joint model using the integrated data.
Image source: N. Gessert, M. Nielsen and M. Shaikh et al. / MethodsX 7 (2020) 100864- Please first prepare image and tabular data separately as fastai LabelLists, and then integrate them using the
get_imagetabdatasets
function as below:
integrate_train, integrate_valid, integrate_test = get_imagetabdatasets(image_data, tab_data)
- The train, validation, and optional test datasets can then be combined in a DataBunch:
db = DataBunch.create(integrate_train, integrate_valid, integrate_test,
path=data_path, bs=bs)
- Next, we create a joint model to train on both image and tabular data simultaneously:
integrate_model = CNNTabularModel(cnn_model,
tabular_model,
layers = [cnn_out_sz + tab_out_sz, 32],
ps=0.2,
out_sz=2).to(device)
- Finally, we pack everying into a fastai learner and train the joint model:
learn = Learner(db, integrate_model)
learn.fit_one_cycle(10, 1e-4)
The following notebook puts everything together and shows how to use the library for the SIIM-ISIC Melanoma Classification competition on Kaggle:
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
image_tabular-0.0.6.tar.gz
(2.2 MB
view hashes)
Built Distribution
Close
Hashes for image_tabular-0.0.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e61ee59b7a9d80e935823592ca0f90cfb63f2b26d6da2e6ad53dc8c7b9a49024 |
|
MD5 | ff49098002853deddd869196c4271f07 |
|
BLAKE2b-256 | 7a090f853b0b59925ddf5ab3a75e99b6091e473291c75c33d8b757fd946ed9d5 |