How to feed the output of a neural network into another neural network?

Hello,
this question might sound strange but I couldn’t find information about my use case.
My goal is to combine two different neural networks. The first one is running, it gets an image and classifies it. Now I want to feed this output into another network in order to classify a subcategory of this image.
Concrete this means that the first net can classify a buch of flowers and trees, e.g Rose or Palm Tree. The next net should now classify any kind of tree as “tree” and any kind of flower as "flower.

I have got the labels and the output-tensors but the problem is, that these tensors are no images, so they have only 3 dimensions, since they are missing size parameters.
Now I don’t know if there is a more generic net structure to provide just the training on tensors without the image dimensions because I think that convolutional networks are not the right approach.

I wrote a data loader to provide inputs and lables in the following structure:


Those are seven output tensors, that should be represented in two different classes.

In this case, all of the input tensors are flowers, so the labels are structured as flowers:

33

I defined flowers as 0 and trees as 1.
If I try to feed this input into a pre-trained model, it is missing a dimension, my own networks are also failing and I wonder where to start.

Thank you very much in advance.

If I understand the use case correctly, you would like to get the general classes based on sub-categories from another model.
If that’s the case, wouldn’t a simple mapping just work, i.e. check for the predicted class and apply a mapping to get the more general class (tree, flower)?

I can imagine the opposite use case might work with a staged model, but I’m not sure if a simple if-condition couldn’t work “perfectly” here.

Let me know, if I misunderstood your use case.

Thank you for your answer.

Yes that is exactly what I want but I would like to implement it as a neural network. At this stadium it would not make much sense, since it will be a prototype for future use. Later I want to do multiple classifications on different levels, so i thought of a simple task to get started with the problem. And that is why I try to generalize subclasses.

Is there any way to solve it at this way?