# Semantic Segmentation - Border

**URL:** <https://forums.developer.nvidia.com/t/semantic-segmentation-border/191127>\
**Category:** Jetson Nano\
**Tags:** jetson-inference\
**Created:** [October 4, 2021, 4:16am UTC](https://forums.developer.nvidia.com/t/semantic-segmentation-border/191127 "2021-10-04T04:16:02Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![agarcesc7](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@agarcesc7](https://forums.developer.nvidia.com/u/agarcesc7)\
**Post date:** [October 4, 2021, 4:16am UTC](https://forums.developer.nvidia.com/t/semantic-segmentation-border/191127/1 "2021-10-04T04:16:02Z")

</div>

Hi friends,

Now I am working with semantic segmentation to detect the quality of apples in trees.  
I have a question. How can I improve the segmentation edge.  
I have checked in the jetson inference docs folder and I could see this image that I found interesting and I would like to get to that or improve.

 ![segmentation-cityscapes](https://global.discourse-cdn.com/nvidia/original/3X/7/4/748ab5e987408ab20e602eccf6a72ad07982eed2.jpeg)

However, in the general example we see images of this type, where there is no exactness at the edge of the segmented image.

 ![Segmentation-example](https://global.discourse-cdn.com/nvidia/original/3X/1/a/1aa961359e5fa96d83ad091f2ef447fd5cbac1db.png)

I currently have results like this:

 ![output_1](https://global.discourse-cdn.com/nvidia/original/3X/3/1/31124515fb96126cb42d538a5127fa0d29169d1a.jpeg)  
 ![output_3_](https://global.discourse-cdn.com/nvidia/original/3X/7/2/72a6959a21e55a773ae17d644bf0fe57340ce0ed.jpeg)  
 ![output_2](https://global.discourse-cdn.com/nvidia/original/3X/f/d/fd4e79b7f48f4276ebfbc4fdfc8eb38f441df44a.jpeg)

Apples that are painted red are high quality, blue ones are medium quality, and green apples are poor quality.

What can I do to improve the edge lining of the apples?

---

<div class="post-metadata">

**Author:** ![AastaLLL](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/aastalll/32/14043_2.png) [@AastaLLL](https://forums.developer.nvidia.com/u/AastaLLL)\
**Post date:** [October 4, 2021, 5:23am UTC](https://forums.developer.nvidia.com/t/semantic-segmentation-border/191127/3 "2021-10-04T05:23:34Z")

</div>

Hi,

That’s because the resolution of the output mask is not high enough.  
You can find the resolution information of each model below:

> **[GitHub - dusty-nv/jetson-inference: Hello AI World guide to deploying deep-learning...](https://github.com/dusty-nv/jetson-inference#semantic-segmentation)**
>
> Hello AI World guide to deploying deep-learning inference networks and deep vision primitives with TensorRT and NVIDIA Jetson.

Thanks.

---

<div class="post-metadata">

**Author:** ![agarcesc7](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@agarcesc7](https://forums.developer.nvidia.com/u/agarcesc7)\
**Post date:** [October 4, 2021, 8:31pm UTC](https://forums.developer.nvidia.com/t/semantic-segmentation-border/191127/4 "2021-10-04T20:31:09Z")

</div>

Hi,

In the case of apples, perform a retraining to a new database and not using the existing ones.  
Should I carry out the labeling of images with higher resolution, and then the training?  
How many images is it recommended to label for each type of apple?  
What would be the recommendation to improve the output mask result??

---

<div class="post-metadata">

**Author:** ![AastaLLL](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/aastalll/32/14043_2.png) [@AastaLLL](https://forums.developer.nvidia.com/u/AastaLLL)\
**Post date:** [October 6, 2021, 6:32am UTC](https://forums.developer.nvidia.com/t/semantic-segmentation-border/191127/5 "2021-10-06T06:32:44Z")

</div>

Hi,

The output resolution is related to the network architecture.  
Do you retrain it with a model shared in the above link?  
If yes, please share which model do you use.

Thanks.

---

<div class="post-metadata">

**Author:** ![agarcesc7](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@agarcesc7](https://forums.developer.nvidia.com/u/agarcesc7)\
**Post date:** [October 6, 2021, 2:48pm UTC](https://forums.developer.nvidia.com/t/semantic-segmentation-border/191127/6 "2021-10-06T14:48:38Z")

</div>

Hi,

Hello there,

I am using the tutorial:

> **[Edge AI: Semantic Segmentation on Nvidia Jetson](https://www.highvoltagecode.com/post/edge-ai-semantic-segmentation-on-nvidia-jetson/)**
>
> Hi, in this tutorial I'll show you how you can use your NVIDIA Jetson Nano/TX1/TX2/Xavier NX/AGX Xavier to perform real-time semantic image…

and using fcn\_resnet18…

---

<div class="post-metadata">

**Author:** ![agarcesc7](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@agarcesc7](https://forums.developer.nvidia.com/u/agarcesc7)\
**Post date:** [October 10, 2021, 1:16pm UTC](https://forums.developer.nvidia.com/t/semantic-segmentation-border/191127/7 "2021-10-10T13:16:39Z")

</div>

Hello there,

Please can you support me by indicating if I should make any modifications to improve the edge?

---

<div class="post-metadata">

**Author:** ![AastaLLL](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/aastalll/32/14043_2.png) [@AastaLLL](https://forums.developer.nvidia.com/u/AastaLLL)\
**Post date:** [October 12, 2021, 5:54am UTC](https://forums.developer.nvidia.com/t/semantic-segmentation-border/191127/8 "2021-10-12T05:54:19Z")

</div>

Hi,

The tutorial uses `fcn-resnet18-voc-320x320` which indicates the output mask is 320x320.  
So you will get a blurred mask when upscaling it into a standard image size, ex. 1920x1080.

In the **[link](https://github.com/dusty-nv/jetson-inference#semantic-segmentation)** shared above, there is a 2048x1024 resolution model called _fcn-resnet18-cityscapes-2048x1024_.  
Would you mind retraining the model for your use case?

You

---

<div class="post-metadata">

**Author:** ![agarcesc7](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@agarcesc7](https://forums.developer.nvidia.com/u/agarcesc7)\
**Post date:** [October 13, 2021, 3:45am UTC](https://forums.developer.nvidia.com/t/semantic-segmentation-border/191127/9 "2021-10-13T03:45:42Z")

</div>

Hi,

I attach the options that python train.py gives me - h  
In these it can be seen that said model does not appear.

Which one should I use?

 ![image](https://global.discourse-cdn.com/nvidia/original/3X/3/a/3a37321d33d5462f92bc3c6a8c8d1697e74eeaf4.png)

---

<div class="post-metadata">

**Author:** ![AastaLLL](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/aastalll/32/14043_2.png) [@AastaLLL](https://forums.developer.nvidia.com/u/AastaLLL)\
**Post date:** [October 26, 2021, 6:28am UTC](https://forums.developer.nvidia.com/t/semantic-segmentation-border/191127/11 "2021-10-26T06:28:02Z")

</div>

Hi,

Sorry for the late update.

Do you use _jetson\_inference_ for training or a standard PyTorch example?  
Please note that the inference code you tested above is tested with the _jetson\_inference_-based model.

Thanks.

---

<div class="post-metadata">

**Author:** ![agarcesc7](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@agarcesc7](https://forums.developer.nvidia.com/u/agarcesc7)\
**Post date:** [October 27, 2021, 2:01am UTC](https://forums.developer.nvidia.com/t/semantic-segmentation-border/191127/12 "2021-10-27T02:01:06Z")

</div>

Thank you very much, case solved.

---

<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:** [November 17, 2021, 5:10am UTC](https://forums.developer.nvidia.com/t/semantic-segmentation-border/191127/14 "2021-11-17T05:10:56Z")

</div>

Closed on November 17, 2021, 5:10am UTC

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