I found StructuredModel::get_num_labels() is used in many places, so I think have this function may be useful. And we have get_labels(), set_labels() in this class, an additional function seems not a bad idea. I mean comparing with calling ref/unref in pairs could be more efficient.