Torchvision.models.fasterrcnn boxes values

Xiaoyu_Song: <p>Hi, the doc from fasterRCNN said:</p>
<pre><code class="lang-auto">boxes (FloatTensor[N, 4]): the ground-truth boxes in [x1, y1, x2, y2] format,
with values of x between 0 and W and values of y between 0 and H
</code></pre>
<p>In this case, the x1, y1, x2, y2 correspond to the left low corner and right top corner cordinates?<br>
But can not fulfil the 0-W and 0-H range.</p>
<p>My question is, what is x1, y1, x2, y2 positions?<br>
Thank you</p>

user_123454321: <p>(x1, y1) is the top-left corner and (x2,y2) is the bottom-right corner. I am not sure why they would not fulfill the 0-W and 0-H range. They are the width and height of the image right? Surely the points cannot go outside the image ?</p>

Xiaoyu_Song: <p>emmm like a rectangle</p>
<p>x1: 100 y1: 200<br>
x2: 300 y2: 400</p>
<p>so the w: 200, h: 200</p>
<p>and x2, y2 is already out of 0-200 range.</p>

user_123454321: <p>You image shape is (200, 200) ? I think you are confusing image height and width with the rectangle height and width ?</p>

Xiaoyu_Song: <p>that’s an example… another example:<br>
x1: 100, y1: 100<br>
x2: 400, y2: 300</p>
<p>h: 200, w: 300<br>
x2 and y2 also exceed 0-200</p>

user_123454321: <p>The H and W are height and width of the image NOT the rectangle. How can the corners be outside the image ?<br>
Please read the doc of fasterrcnn</p>
<pre><code class="lang-auto">Implements Faster R-CNN.
    The input to the model is expected to be a list of tensors, each of shape [C, H, W], one for each
    image, and should be in 0-1 range. Different images can have different sizes.
    The behavior of the model changes depending if it is in training or evaluation mode.
    During training, the model expects both the input tensors, as well as a targets (list of dictionary),
    containing:
        - boxes (FloatTensor[N, 4]): the ground-truth boxes in [x1, y1, x2, y2] format, with values of x
          between 0 and W and values of y between 0 and H
        - labels (Int64Tensor[N]): the class label for each ground-truth box
</code></pre>
<p>In this example</p>
<pre><code class="lang-auto">x1: 100, y1: 100
x2: 400, y2: 300

h: 200, w: 300
</code></pre>
<p>surely height of image is greater than 300 and width greater than 400, otherwise how will the corners be outside.</p>

Xiaoyu_Song: <aside class="quote no-group" data-username="user_123454321" data-post="6" data-topic="109161">
<div class="title">
<div class="quote-controls"></div>
<img loading="lazy" alt="" width="24" height="24" src="https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/user_123454321/48/27631_2.png" class="avatar"> user_123454321:</div>
<blockquote>
<p>The H and W are height and width of the image NOT the rectangle. How can the corners be outside the image ?</p>
</blockquote>
</aside>
<p>yes. i’m saying that. in the doc. they said x and y are between 0-w and 0-h.<br>
But the value in my example of x and y already bigger than 200 (Height)</p>
<p>SO the definition in doc is wrong? Or the x1, y1, x2, y2 values are defiend wrongly in my example?</p>

Xiaoyu_Song: <p>The H, W is the image height and width, not the h w of the box. Thank you <a class="mention" href="/u/user_123454321">@user_123454321</a></p>