# Detectnet\_v2(resnet50) low accuracy on 2 class dataset

**URL:** <https://forums.developer.nvidia.com/t/detectnet-v2-resnet50-low-accuracy-on-2-class-dataset/241013>\
**Category:** TAO Toolkit\
**Created:** [January 30, 2023, 9:36am UTC](https://forums.developer.nvidia.com/t/detectnet-v2-resnet50-low-accuracy-on-2-class-dataset/241013 "2023-01-30T09:36:44Z")\
**Posts on this page:** 6\
**Page:** 2

<div class="post-metadata">

**Author:** ![Morganh](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/morganh/32/9748_2.png) [@Morganh](https://forums.developer.nvidia.com/u/Morganh)\
**Post date:** [February 10, 2023, 4:16pm UTC](https://forums.developer.nvidia.com/t/detectnet-v2-resnet50-low-accuracy-on-2-class-dataset/241013/22 "2023-02-10T16:16:57Z")

</div>

> [@pddarrell](#):
>
> Does the ubiquitous result of “0” mean something is not set up correctly? - zero is difficult to achieve, isn’t it?

I am afraid yes. Please check

1. Are the labels correct? Especially for the “healthy” class.
2. More, how many images for these two classes separately?
3. Set to the same  
initial\_weight: 10.0  
weight\_target: 10.0
4. Can you share latest training spec?

---

<div class="post-metadata">

**Author:** ![pddarrell](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@pddarrell](https://forums.developer.nvidia.com/u/pddarrell)\
**Post date:** [February 10, 2023, 5:18pm UTC](https://forums.developer.nvidia.com/t/detectnet-v2-resnet50-low-accuracy-on-2-class-dataset/241013/23 "2023-02-10T17:18:15Z")

</div>

> [@Morganh](#):
>
> Are the labels correct? Especially for the “healthy” class.

“healthy” image and label files have a “0” as the first digit:  
They start at “000001” and are not entirely consecutive e.g:

 ![000016](https://global.discourse-cdn.com/nvidia/original/3X/1/3/132cb4cd7154fad964da935ee031e0d0be9047fd.jpeg)

[000016.txt](https://forums.developer.nvidia.com/uploads/short-url/bin2LaaCnOikhhTcWyGGVcJ8xqh.txt) (76 Bytes)

“damage” image and label files have a “1” as the first digit:

 ![286](https://global.discourse-cdn.com/nvidia/original/3X/5/8/583d5d9af1c821ac72ed5fa705c0fad09a9529c0.jpeg)

[100268.txt](https://forums.developer.nvidia.com/uploads/short-url/5ezVPs6qajEctjhCYdE93NojoOn.txt) (74 Bytes)

I believe the labels are 100% correct. I hand-labelled them and I have checked them very carefully.

> Blockquote

 ![Screenshot from 2023-02-10 16-48-49](https://global.discourse-cdn.com/nvidia/original/3X/d/b/dba8ac9c53761b8ca38e2be123a51bd044dddd63.png)  
In train/val: 531 “healthy”, 531 “damage”  
In test: 10 “healthy”, 10 “damage”

> Blockquote  
> currently the settings in “cost\_function\_config” are:

cost\_function\_config {  
target\_classes {  
name: “damage”  
class\_weight: 8.0  
coverage\_foreground\_weight: 0.0500000007451  
objectives {  
name: “cov”  
initial\_weight: 1.0  
weight\_target: 1.0  
}  
objectives {  
name: “bbox”  
initial\_weight: 10.0  
weight\_target: 1.0  
}  
}  
target\_classes {  
name: “healthy”  
class\_weight: 1.0  
coverage\_foreground\_weight: 0.0500000007451  
objectives {  
name: “cov”  
initial\_weight: 1.0  
weight\_target: 1.0  
}  
objectives {  
name: “bbox”  
initial\_weight: 10.0  
weight\_target: 10.0  
}  
}  
To be 100% sure: do you want me to reset the initial\_weight and weight\_target of both classes to 10.0?

> Blockquote  
> [detectnet\_v2\_train\_resnet50\_kitti.txt](https://forums.developer.nvidia.com/uploads/short-url/f5AMoXkv9iOeJg4GclLRSG5RYXp.txt) (4.2 KB)  
> This is the latest training spec before I reset the initial\_weight and weight\_target of both classes to 10.0.

---

<div class="post-metadata">

**Author:** ![Morganh](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/morganh/32/9748_2.png) [@Morganh](https://forums.developer.nvidia.com/u/Morganh)\
**Post date:** [February 11, 2023, 4:17am UTC](https://forums.developer.nvidia.com/t/detectnet-v2-resnet50-low-accuracy-on-2-class-dataset/241013/24 "2023-02-11T04:17:48Z")

</div>

For healthy class, from the label file,

```auto
healthy 0.00 0 0.00 0.0 0.0 3648.0 1417.0 0.00 0.00 0.00 0.00 0.00 0.00 0.00

```

It is 1920x746 image, why the bbox is (0.0 0.0 3648.0 1417.0) ?

---

<div class="post-metadata">

**Author:** ![pddarrell](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@pddarrell](https://forums.developer.nvidia.com/u/pddarrell)\
**Post date:** [February 11, 2023, 12:36pm UTC](https://forums.developer.nvidia.com/t/detectnet-v2-resnet50-low-accuracy-on-2-class-dataset/241013/25 "2023-02-11T12:36:52Z")

</div>

> [@Morganh](#):
>
> It is 1920x746 image, why the bbox is (0.0 0.0 3648.0 1417.0) ?

 ![Screenshot from 2023-02-11 12-31-19](https://global.discourse-cdn.com/nvidia/original/3X/3/a/3a628e8aa4ab7c20b1c561a47df4858f448a68c6.png)  
image size of 000016.jpg is 3648 x 1417. I guess the forum formatting has resized the image that you are seeing. The label is correct.

---

<div class="post-metadata">

**Author:** ![pddarrell](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@pddarrell](https://forums.developer.nvidia.com/u/pddarrell)\
**Post date:** [February 12, 2023, 7:24pm UTC](https://forums.developer.nvidia.com/t/detectnet-v2-resnet50-low-accuracy-on-2-class-dataset/241013/26 "2023-02-12T19:24:20Z")

</div>

> [@pddarrell](#):
>
> Does the notebook allow the confidence threshold to be adjusted? Maybe it is a confidence issue?

Problem solved. I had the coverage\_threshold for “healthy” in postprocessing\_config set too high. Interestingly, when I lowered it the first time the average precision of “damage” improved and “healthy” stayed at “0”. It encouraged me to lower it further and, finally, I got a non-zero value for “healthy” too.

 ![Screenshot from 2023-02-12 19-22-28](https://global.discourse-cdn.com/nvidia/original/3X/7/2/722cff5428539575a4cc7d0e0d7b7065bb216abc.png)

These experiments are only run for 10 epochs, so I am hopeful that further improvements are possible at ~ 120 epochs.

Basically I had not fully appreciated what “mean average precision” was doing and what it was affected by.  
I found this blog helpful:  
[https://machinethink.net/blog/object-detection](https://machinethink.net/blog/object-detection)

Thank you for being a great help.

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/system/32/68080_2.png) [@system](https://forums.developer.nvidia.com/u/system)\
**Post date:** [February 26, 2023, 7:24pm UTC](https://forums.developer.nvidia.com/t/detectnet-v2-resnet50-low-accuracy-on-2-class-dataset/241013/27 "2023-02-26T19:24:57Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.

[Previous page](https://forums.developer.nvidia.com/t/detectnet-v2-resnet50-low-accuracy-on-2-class-dataset/241013.md?page=1)
