Collect training data from the lib when compiled with -DTRAIN