piggy2009 / DM_underwater

This is the code of the paper "Underwater Image Enhancement by Transformer-based Diffusion Model with Non-uniform Sampling for Skip Strategy"
29 stars 4 forks source link

About how to replace your own dataset #1

Open nil0330 opened 1 year ago

nil0330 commented 1 year ago

I would like to replace the dataset on your model with my own dataset to see the generated results, but I'm not sure what 'hr_256' and 'sr_16_256' mean, and how to prepare my own dataset in this format.

unnamed1024 commented 1 year ago

I had the same problem. I think 'sr' means super_resolution, and 'hr' means high_resolution in this program. However, I'm wondering why the folder named 'water_val_16_256' has this two subfolders.

yangtongbry commented 12 months ago

sr和hr有什么区别呢

Honeybadger-LSX commented 10 months ago

Image-Super-Resolution-via-Iterative-Refinement I have found the Initial code reference.

Henry-Bi commented 9 months ago

For the custom dataset preparation, you only need to split the dataset to train, val and test. For example:

And then, you should modify the dict 'datasets' in config/underwater.json line 16-38. For example,

"dataset": { "train": { "dataroot" : "datasets/train", }} After that, the code works well.

cinamon123 commented 5 months ago

Yes, and this issue is still not been improved. Moreover, data examples provided by author in the repository are extremely confusing. It appears that "hr_256" is the image processed by "sr_18_256", yet both of these folders are indispensable during inference. However, it seems that only "sr_18_256" is processed in the end. This is truly perplexing!

After briefly reviewing the author's paper and code, I would like to propose the following speculations here. If the author does not reply, then I assume my understanding is correct by default. That is to say, if the author does not explicitly point out where I am wrong, I will not know how to correct... I'm so sorry......

Well... My speculations are as follows:

  1. "prepare_data.py" can output data in the format of the author's test files, such as cropped and resized 128128 images, as well as a set of low-resolution 128128 images upsampled again from the previously obtained 1616 images using the above methods. However, after checking the corresponding paper, it seems that the input data should only require a square image (128128, 256256, 512*512, etc.).

  2. It seems that the only images processed by the model are "sr_18_256". Therefore, it is not quite clear why the author chose to use this .py file to process the data. It actually makes the processed images blurrier, and it seems that the hr images are not being utilized.

Therefore, if you want to use your own data, I speculate that the steps should be as follows:

  1. Run "prepare_data.py" using, for example, use this command: python your_script.py --path /your/image/directory --out /output/directory --size 64,512 --n_worker 1 --resample bicubic

  2. Run "infer.py". Then find your results in the "experiment_model" directory.

However, this data pre-process makes results so blur. Therefore, I just use the resized images. And resize then back after processing. I think this way can minimize the loss of information.

It would be nice if the author is open to correcting my perspective.

Saini-Praveen commented 3 months ago

For the custom dataset preparation, you only need to split the dataset to train, val and test. For example:

* dataset
  -- train
  --- hr_256 (where put the input images)
  --- sr_16_256 (where put the annotated images)
  -- val
  -- test

And then, you should modify the dict 'datasets' in config/underwater.json line 16-38. For example,

"dataset": { "train": { "dataroot" : "datasets/train", }} After that, the code works well.

Hi, I have some queries,

  1. Image in dataset need to be in square resolution in any custom dataset for training, something as 256 x 256.
  2. In result we are getting the 4 images as output corresponding to 1 image, which one is required to compute the psnr, ssim value for comparing with ground truth.
  3. here, is hr_256 means the ground truth/reference, and sr_16_256 as raw image.
  4. do we need to do preprocessing of data using prepare_data.py

Your help is needed to train this model.