# Test issue in semantic segmentation using DL4J

**URL:** <https://community.konduit.ai/t/test-issue-in-semantic-segmentation-using-dl4j/100>\
**Category:** DL4J\
**Created:** [January 25, 2020, 11:15am UTC](https://community.konduit.ai/t/test-issue-in-semantic-segmentation-using-dl4j/100 "2020-01-25T11:15:16Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![AbdelmajidB](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/abdelmajidb/32/56_2.png) [@AbdelmajidB](https://community.konduit.ai/u/AbdelmajidB)\
**Post date:** [January 25, 2020, 11:15am UTC](https://community.konduit.ai/t/test-issue-in-semantic-segmentation-using-dl4j/100/1 "2020-01-25T11:15:17Z")

</div>

Hi everyone,  
I have a trained semantic model based on U-net. I have 34 test images with the corresponding ground truth, i want to test image by image and finally calculate the mean and standard deviation of accuracy, f1 score, recall, and precision. When i put all 34 images in the test folder and evaluation image by image i get good results but when i put in the test folder just one image that i want to test, i get poor results i don’t know what is the source of this issue.

The following code is used test the model image by image: [https://gist.github.com/AbdelmajidB/92f5fc3013c81b28c898b64118b6adb5](https://gist.github.com/AbdelmajidB/92f5fc3013c81b28c898b64118b6adb5)

---

<div class="post-metadata">

**Author:** ![eraly](https://avatars.discourse-cdn.com/v4/letter/e/a698b9/32.png) [@eraly](https://community.konduit.ai/u/eraly)\
**Post date:** [January 26, 2020, 8:19pm UTC](https://community.konduit.ai/t/test-issue-in-semantic-segmentation-using-dl4j/100/2 "2020-01-26T20:19:02Z")

</div>

Hi, It’s hard to tell what is wrong without more code. How are you verifying they are different? How different are the results? The eval stats for the one image you are testing should be the same irrespective of the other images in the folder since you are doing a reset.

---

<div class="post-metadata">

**Author:** ![AbdelmajidB](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/abdelmajidb/32/56_2.png) [@AbdelmajidB](https://community.konduit.ai/u/AbdelmajidB)\
**Post date:** [January 26, 2020, 8:51pm UTC](https://community.konduit.ai/t/test-issue-in-semantic-segmentation-using-dl4j/100/3 "2020-01-26T20:51:20Z")

</div>

Hi eraly, thank you for your reply.

i have trained a U-net based model on DL4J on medical images. The code above is for testing the model. my objective is to test the model on 34 2d medical images separately and get the segmentation metrics (accuracy, recall…) for each image, so i tried two ways:  
1- when i put all the 34 images in the test folder (“testI”) and i run the code above which will load all the images and test image by image i get good segmentation performance for all the images (even without reset() method),  
2- but when i put just one image that i want to test from the 34 in test folder and i execute the code above i get bad results in term of accuracy, recall…), that means i get different segmentation results for the same images by using the two approaches.  
This is my label generator code: [MyPathLabelGenerator.java · GitHub](https://gist.github.com/AbdelmajidB/fccb871836746dd4f0d6e32828eadcdf)

---

<div class="post-metadata">

**Author:** ![eraly](https://avatars.discourse-cdn.com/v4/letter/e/a698b9/32.png) [@eraly](https://community.konduit.ai/u/eraly)\
**Post date:** [January 27, 2020, 6:05pm UTC](https://community.konduit.ai/t/test-issue-in-semantic-segmentation-using-dl4j/100/4 "2020-01-27T18:05:48Z")

</div>

Can you file an issue with the model? Thanks

---

<div class="post-metadata">

**Author:** ![AbdelmajidB](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/abdelmajidb/32/56_2.png) [@AbdelmajidB](https://community.konduit.ai/u/AbdelmajidB)\
**Post date:** [January 27, 2020, 6:26pm UTC](https://community.konduit.ai/t/test-issue-in-semantic-segmentation-using-dl4j/100/5 "2020-01-27T18:26:24Z")

</div>

i didn’t understand your question, if you talk about the DL model, i use U-net version available in DL4j, which works will, i have just an issue in test phase that i can’t understand.

---

<div class="post-metadata">

**Author:** ![eraly](https://avatars.discourse-cdn.com/v4/letter/e/a698b9/32.png) [@eraly](https://community.konduit.ai/u/eraly)\
**Post date:** [January 27, 2020, 6:50pm UTC](https://community.konduit.ai/t/test-issue-in-semantic-segmentation-using-dl4j/100/6 "2020-01-27T18:50:23Z")

</div>

Hi, If it’s just the u-net version available in DL4J that’s fine. The earlier post says “model based on U-net”.

---

<div class="post-metadata">

**Author:** ![eraly](https://avatars.discourse-cdn.com/v4/letter/e/a698b9/32.png) [@eraly](https://community.konduit.ai/u/eraly)\
**Post date:** [January 27, 2020, 7:30pm UTC](https://community.konduit.ai/t/test-issue-in-semantic-segmentation-using-dl4j/100/7 "2020-01-27T19:30:07Z")

</div>

Can you still file an issue anyway? Since this sounds like a bug.

---

<div class="post-metadata">

**Author:** ![AbdelmajidB](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/abdelmajidb/32/56_2.png) [@AbdelmajidB](https://community.konduit.ai/u/AbdelmajidB)\
**Post date:** [January 27, 2020, 7:46pm UTC](https://community.konduit.ai/t/test-issue-in-semantic-segmentation-using-dl4j/100/8 "2020-01-27T19:46:36Z")

</div>

yes i used the standard version available in DL4J with some changes in the hyper-parameters. Yes i can file an issue but where? is here: [Issues · eclipse/deeplearning4j · GitHub](https://github.com/eclipse/deeplearning4j/issues)

---

<div class="post-metadata">

**Author:** ![AbdelmajidB](https://yyz1.discourse-cdn.com/flex035/user_avatar/community.konduit.ai/abdelmajidb/32/56_2.png) [@AbdelmajidB](https://community.konduit.ai/u/AbdelmajidB)\
**Post date:** [January 27, 2020, 7:48pm UTC](https://community.konduit.ai/t/test-issue-in-semantic-segmentation-using-dl4j/100/9 "2020-01-27T19:48:50Z")

</div>

i opened an issue here: [Test issue in semantic segmentation using DL4J · Issue #8644 · eclipse/deeplearning4j · GitHub](https://github.com/eclipse/deeplearning4j/issues/8644)
