akshay-kap / Meng-699-Image-Banding-detection

This is the official repository for the Deep Banding Index paper Implementation. I worked on this project as a graduate researcher under Dr. Zhou Wang. The research project resulted is in ICASSP 2021 Conference paper on Banding, CNN, and Data Science for Image Processing.
17 stars 1 forks source link

Variables dx and dy in Patches Generation code #4

Open lskdream opened 1 year ago

lskdream commented 1 year ago

Hi there,

I noticed a potential issue in the code snippet you provided from the file '/src/Generating_patches_from_HD_images.py'. It seems that there might be an error in assigning the variables dx and dy. The highlighted parts in the following code seem to have incorrect variable assignments: (line 56, 57)

dx = min(max(X1[1],X1[0]),max(X2[1],X2[1]))- max(min(X1[0],X1[0]),min(X2[0],X2[0])) dy = min(max(Y1[1],Y1[0]),max(Y2[1],Y2[1]))- max(min(Y1[0],Y1[0]),min(Y2[0],Y2[0]))

I don't quite understand what's point of computing the parts in bold since the same elements were given either in max() or min(). Could you enlighten me here?

Based on my understanding and the solution mentioned in the link here, I believe the correct code should be:

dx = min(max(X1[0],X1[1]),max(X2[0],X2[1]))- max(min(X1[0],X1[1]),min(X2[0],X2[1]))
dy = min(max(Y1[0],Y1[1]),max(Y2[0],Y2[1]))- max(min(Y1[0],Y1[1]),min(Y2[0],Y2[1]))

Please review the modified code and let me know if my understanding aligns with your expectations. Feel free to correct me if I have misunderstood any aspect.


Update:

Upon further investigation, I realized that the outputs of max(X2[1], X2[1]) and (X2[0], X2[1]) are indeed both X2[1], and the same applies to other instances of max() and min(). Therefore, it appears that the code is correct in this regard. However, I have discovered another issue. The total number of generated banded patches (54,286) and nonbanded patches (155,639) does not match the total numbers mentioned in the paper (banded: 73,867 / nonbanded: 95,634).

Did I miss something?

akshay-kap commented 3 months ago

Thanks for looking into these things. Banded and non-banded patches are randomly selected from defined data categories, eg: we would have some images of nature, some animated images, some images from city life, etc. The idea was to select random images from each such category to have a diverse dataset. The data used to train was a subset of the total patches generated.