# TMVA read image data for application of a CNN model

**URL:** <https://root-forum.cern.ch/t/tmva-read-image-data-for-application-of-a-cnn-model/54181>\
**Category:** TMVA\
**Tags:** rdataframe, tmva, root\
**Created:** [March 22, 2023, 7:15pm UTC](https://root-forum.cern.ch/t/tmva-read-image-data-for-application-of-a-cnn-model/54181 "2023-03-22T19:15:07Z")\
**Posts on this page:** 1\
**Showing post:** 4

<div class="post-metadata">

**Author:** ![moneta](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/moneta/32/19423_2.png) [@moneta](https://root-forum.cern.ch/u/moneta)\
**Post date:** [March 27, 2023, 9:15am UTC](https://root-forum.cern.ch/t/tmva-read-image-data-for-application-of-a-cnn-model/54181/4 "2023-03-27T09:15:55Z")

</div>

Hi,  
For the `RReader` class one needs to modify the `Compute` functor passed to `RDataFrame` to handle vector data. Attached you find the example code, defining a new functor to use with `RRdataFrame`.

I also attach the example code for using the Reader class in this case. Since `AddVariableArray` is missing one needs to declare each single vector element, as shown in the attached code. I will add this missing function in the next release.

Best Regards

Lorenzo

[TMVA\_CNN\_RReader.C](https://root-forum.cern.ch/uploads/short-url/gVjUtYzQnsAo74rAEkVXFAdRnk7.C) (908 Bytes)  
[TMVA\_CNN\_ClassificationApplication.C](https://root-forum.cern.ch/uploads/short-url/o0sdeFTMnFnfXNOEekCqQXgQVm6.C) (8.1 KB)

---

_[View the full topic](https://root-forum.cern.ch/t/tmva-read-image-data-for-application-of-a-cnn-model/54181)._
