Is there any research or mature model for predicting a number from an image?

SouthTorch: <p>CNN as far as I know is suitable to recognize the patterns in image and connect them with a label. How about recognize the patterns and connect them with a number? For example, an image of porous media crosssection view, with a look, the model can estimate the resistance when a certain fluid flow through it.</p>
<p>Is CNN suitable for this work? Or some version of modified CNN suitable for this work? Is there a well-known public dataset to test this kind of model, like MNIST and CIFAR10?</p>
<p>Thanks.</p>

KFrank: <p>Hi David!</p>
<aside class="quote no-group" data-username="SouthTorch" data-post="1" data-topic="154653" data-full="true">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/letter_avatar_proxy/v4/letter/s/c89c15/48.png" class="avatar"> SouthTorch:</div>
<blockquote>
<p>How about recognize the patterns and connect them with a number?</p>
</blockquote>
</aside>
<p>Yes, using a neural network to predict a number, rather than a class label,<br>
is perfectly reasonable.</p>
<p>This kind of problem is sometimes called “regression,” in contrast to<br>
classification.</p>
<p>The notion is that you are predicting a continuous number that can be<br>
closer (better) to or further away (worse) from the ground-truth value<br>
for that number.</p>
<p>The upstream “image-processing” part of the model might be the same<br>
for a classification and a regression problem, with only the last layer (or<br>
the last few layers) differing.  If you are predicting a single number, your<br>
last layer might be a <code>Linear</code> with <code>out_features = 1</code>.  You would then<br>
typically use <code>MSELoss</code> as the loss function that compares your predicted<br>
value with your ground-truth value.</p>
<p>I don’t know offhand about any specific research about this, but I’m sure<br>
a lot is out there, as this is a common use case.</p>
<p>Best.</p>
<p>K. Frank</p>

SouthTorch: <p>Thanks, Frank!</p>
<p>How about the activation functions in those middle layers? If I use ReLU, I am afraid the many information will get lost. But if I don’t use ReLU, I am afraid the picture’s texture (or call it “context” or “pattern”) will not be find out. And make the deep learning just like a full connection regression.</p>

KFrank: <p>Hi David!</p>
<aside class="quote no-group" data-username="SouthTorch" data-post="3" data-topic="154653" data-full="true">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/letter_avatar_proxy/v4/letter/s/c89c15/48.png" class="avatar"> SouthTorch:</div>
<blockquote>
<p>How about the activation functions in those middle layers?</p>
</blockquote>
</aside>
<p>The choice of activation functions – and more generally, the choice of<br>
network architecture – will depend on the details of your use case, and<br>
the preferred choices are determined, in practice, by experimentation<br>
(or prior experience), rather than theoretical considerations.</p>
<p>For example, consider the “regression” of predicting a person’s body-mass<br>
index from an image.  You could well imagine that a network architecture<br>
(and perhaps even a pre-trained network) for classifying people vs. cats<br>
might do very well at recognizing the relevant “people features,” with only<br>
the output-the-BMI layer being different.</p>
<p>A network used for semantic segmentation of vegetation vs. dirt in satellite<br>
images – seemingly a texture-centric task – might well be a better fit for<br>
your use case.</p>
<p>The point being that the nature of the images and the relevant features<br>
are more important for the choice of network architecture (and activation<br>
functions) than is whether you are performing regression or classification.</p>
<p>Best.</p>
<p>K. Frank</p>