I have image data along with csv file where each row of csv file contains attributes for corresponding image.

I want to use images as well as csv file data to build CNN model using Keras.

What is preferred way of doing it?

  • I can append the attribute data with numpy array of image and train the model.
  • I can create 2 different models and use average/voting for prediction.

I think, in 1st appraoch csv file data which has around 50 columns would hardly matter as image shape is (128*128*3). Is it correct? and how can I give more importance to csv file (like 60% weightage to image data and 40% to csv file).

And again how CNN would work with that CSV file data as CNN is preferred on Image Data?


1 Answer 1


Kera's functional API allows arbitrary models to be combined.

One option is to define a "main input" as the image that feeds into a CNN and then define an "auxiliary input" that feeds into a MLP. Both of those sub-models can feed to the same higher layers. The weights of the entire model will be updated during training. The model will learn how to weight the data from csv compared to the image data (in contrast to you picking the relative weights).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.