How to set ResNet50 structure with cnn of TMVA

Structure of ResNet50 or ResNet152 is so powerful than the flat cnn, can someone give an example to use TMVA or other root code (better with c++) to set up the same cnn structure as ResNet? Thanks in advance!

Best Regards
siguang

@sitong @moneta can you help maybe?

Hi,

The way this is currently supported in TMVA is through the generic keras interface. This means you have to set up you model with keras, save it to disk and load it through the TMVA PyKeras methods.

Please note that any problems you might encouter with external applications or code such as keras, tensorflow, and the linked git repositories and gists are unfortunately not covered in this forum.

A sketch in python, provided for reference, follows below. Adaption to c++ should be straightforward. You would still need to generate the keras model through python.

# Create directory structure
mkdir tmvaresnet
cd tmvaresnet

# Get stuff
wget https://gist.githubusercontent.com/ashlaban/6be0ddc58d940d6ab1783ac0dbab19cc/raw/d5e8d6d8a0c7be8a2dab78f4582e450b2c20a1b7/resnet.py
wget https://gist.githubusercontent.com/ashlaban/142827263a51488c3098da0e456a197a/raw/0c21228cb1ee29ad4402bb4c674cfebe3872a5a1/train.py
git clone https://github.com/stwunsch/tmva_mnist.git

# Run training
python tmva_mnist/create_dataset.py
python train.py

This is tested on my local machine with a recent check out from the development version. Your mileage might vary :slight_smile:

Note: I did not inspect the output of this script since it takes ages to run on my laptop. It seems to work as it is training and converging.

Links to the gists in clickable form:

Cheers,
Kim