EESRGAN icon indicating copy to clipboard operation
EESRGAN copied to clipboard

IndexError: list index out of range

Open jinzhenmu opened this issue 4 years ago • 33 comments

  • python3 test.py -c config_GAN.json

  • 480 [250000, 500000, 750000] Traceback (most recent call last): File "test.py", line 96, in main(config) File "test.py", line 19, in main tester.test() File "/home/mjz/2D_Detcetion/EESRGAN/trainer/cowc_GAN_FRCNN_trainer.py", line 38, in test self.model.test(self.data_loader, train=False, testResult=True) File "/home/mjz/2D_Detcetion/EESRGAN/model/ESRGAN_EESN_FRCNN_Model.py", line 273, in test evaluate(self.netG, self.netFRCNN, self.targets, self.device) File "/usr/local/lib/python3.6/dist-packages/torch/autograd/grad_mode.py", line 49, in decorate_no_grad return func(*args, **kwargs) File "/home/mjz/2D_Detcetion/EESRGAN/detection/engine.py", line 140, in evaluate coco = get_coco_api_from_dataset(data_loader.dataset) File "/home/mjz/2D_Detcetion/EESRGAN/detection/coco_utils.py", line 255, in get_coco_api_from_dataset return convert_to_coco_api(dataset) File "/home/mjz/2D_Detcetion/EESRGAN/detection/coco_utils.py", line 154, in convert_to_coco_api img, targets = ds[img_idx] File "/home/mjz/2D_Detcetion/EESRGAN/scripts_for_datasets/COWC_EESRGAN_FRCNN_dataset.py", line 32, in getitem img_path_gt = os.path.join(self.data_dir_gt, self.imgs_gt[idx]) IndexError: list index out of range

jinzhenmu avatar Apr 13 '20 06:04 jinzhenmu

-- Make sure you have .jpg images: https://github.com/Jakaria08/EESRGAN/blob/7aaae20752e13566dcf119ff1d1d521d0184f6aa/scripts_for_datasets/COWC_EESRGAN_FRCNN_dataset.py#L25

-- If you have .png images change the image types to .png.

-- Make sure you have correct path here: https://github.com/Jakaria08/EESRGAN/blob/7aaae20752e13566dcf119ff1d1d521d0184f6aa/config_GAN.json#L27 -- Here: https://github.com/Jakaria08/EESRGAN/blob/7aaae20752e13566dcf119ff1d1d521d0184f6aa/config_GAN.json#L28 -- And here: https://github.com/Jakaria08/EESRGAN/blob/7aaae20752e13566dcf119ff1d1d521d0184f6aa/config_GAN.json#L101 -- Make sure to put ''/" at the end of directory address.

Jakaria08 avatar Apr 15 '20 02:04 Jakaria08

Thanks !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

  • it's nice work for small object detection

  • i will try the code again.

jinzhenmu avatar Apr 15 '20 02:04 jinzhenmu

@jinzhenmu Were you able to fix this issue? I'm getting the same error.

themousepotato avatar Oct 09 '20 09:10 themousepotato

The problem lies with this variable: self.imgs_gt. The program does not able to get the data somehow. This is the only problem, I think. Try to print the variable to see what it contains. Here: https://github.com/Jakaria08/EESRGAN/blob/7aaae20752e13566dcf119ff1d1d521d0184f6aa/scripts_for_datasets/COWC_EESRGAN_FRCNN_dataset.py#L25 Try to follow my first comment in this issue. I hope it would help.

Jakaria08 avatar Oct 09 '20 13:10 Jakaria08

这个问题,我当时解决了。注意查看json文件里面的配置。主要关注数据集的路径。

| | 牟金震 邮箱:[email protected] |

签名由 网易邮箱大师 定制

On 10/09/2020 22:00, Jakaria Rabbi wrote:

The problem lies with this variable: self.imgs_gt. The program does not able to get the data somehow. This is the only problem, I think. Try to print the variable to see what it contains. Here: https://github.com/Jakaria08/EESRGAN/blob/7aaae20752e13566dcf119ff1d1d521d0184f6aa/scripts_for_datasets/COWC_EESRGAN_FRCNN_dataset.py#L25 Try to follow my first comment in this issue. I hope it would help.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

jinzhenmu avatar Oct 09 '20 14:10 jinzhenmu

I just noticed that my error was a little different. For me, it's self.annotation which is empty. Could you please elaborate on how are we generating the validation set? I'd done generate_mod_LR_bic() of scripts_GAN_HR-LR.py (Running other functions leads to error since I don't have all the data). All the data was with me other than /home/jakaria/Super_Resolution/Filter_Enhance_Detect/saved/*.

From the pretrainied weights, I was able to get the following:

        "pretrain_model_G": "/home/jakaria/Super_Resolution/Filter_Enhance_Detect/saved/pretrained_models_EESRGAN_FRCNN/170000_G.pth",
        "pretrain_model_D": "/home/jakaria/Super_Resolution/Filter_Enhance_Detect/saved/pretrained_models_EESRGAN_FRCNN/170000_D.pth",
        "pretrain_model_FRCNN": "/home/jakaria/Super_Resolution/Filter_Enhance_Detect/saved/pretrained_models_EESRGAN_FRCNN/170000_FRCNN.pth",

What should I do for the data other than this in `/home/jakaria/Super_Resolution/Filter_Enhance_Detect/saved/*? @Jakaria08 @jinzhenmu

Edit: I'm trying to reproduce the results using pretrained weights FYI

themousepotato avatar Oct 09 '20 15:10 themousepotato

in my case,I put the annotation *.txt files in HR,LR and Bic, but it should be put in HR/x4,after fixed this,I meet RuntimeError: CUDA out of memory. by the way, how to generating the validation set?

cl886699 avatar Oct 12 '20 07:10 cl886699

@cl886699 From where did you get those annotation files? Even I don't know how to generate the validation set.

themousepotato avatar Oct 12 '20 10:10 themousepotato

@cl886699 From where did you get those annotation files? Even I don't know how to generate the validation set.

mybe copy_folder_name_for_valid_image (line of 92 in scripts_GAN_HR-LR.py) this function can get the validation data.

cl886699 avatar Oct 12 '20 10:10 cl886699

@cl886699 But I don't have the data for /home/jakaria/Super_Resolution/Filter_Enhance_Detect/saved_ESRGAN/val_images/*/. What should it be? I haven't done any training. I'm trying to reproduce the results using the pretrained weights.

themousepotato avatar Oct 12 '20 14:10 themousepotato

@cl886699 But I don't have the data for /home/jakaria/Super_Resolution/Filter_Enhance_Detect/saved_ESRGAN/val_images/*/. What should it be? I haven't done any training. I'm trying to reproduce the results using the pretrained weights.

val_images means validation datasets,you should split datasets to train,val and test, you should do it by yourself. if you just want to test this model, you can choose annother city's data to test

cl886699 avatar Oct 13 '20 02:10 cl886699

Hey @cl886699, were you able to generate the validation set? I still can't figure that out. I'm also planning to work with the model other than just testing it.

themousepotato avatar Oct 23 '20 16:10 themousepotato

I'm getting this error now. I'd copied the annotation files and placed a single validation image in the folders.

(image-sr) navaneeth@mousebox:~/workspace/image-super-resolution/EESRGAN$ python test.py -c config_GAN.json
400000
[250000, 500000, 750000]
creating index...
index created!
Test:  [0/1]  eta: 0:00:01  model_time: 1.5657 (1.5657)  evaluator_time: 0.0360 (0.0360)  time: 1.7147  data: 0.1107  max mem: 651
Test: Total time: 0:00:01 (1.9105 s / it)
Averaged stats: model_time: 1.5657 (1.5657)  evaluator_time: 0.0360 (0.0360)
Accumulating evaluation results...
DONE (t=0.02s).
IoU metric: bbox
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.564
 Average Precision  (AP) @[ IoU=0.50      | area=   all | maxDets=100 ] = 0.564
 Average Precision  (AP) @[ IoU=0.75      | area=   all | maxDets=100 ] = 0.564
 Average Precision  (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.564
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.752
 Average Precision  (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = -1.000
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=  1 ] = 0.000
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets= 10 ] = 0.750
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.750
 Average Recall     (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.750
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.750
 Average Recall     (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = -1.000
Detection started........
1
Traceback (most recent call last):
  File "test.py", line 96, in <module>
    main(config)
  File "test.py", line 19, in main
    tester.test()
  File "/home/navaneeth/workspace/image-super-resolution/EESRGAN/trainer/cowc_GAN_FRCNN_trainer.py", line 38, in test
    self.model.test(self.data_loader, train=False, testResult=True)
  File "/home/navaneeth/workspace/image-super-resolution/EESRGAN/model/ESRGAN_EESN_FRCNN_Model.py", line 273, in test
    evaluate_save(self.netG, self.netFRCNN, self.targets, self.device, self.config)
  File "/home/navaneeth/anaconda3/envs/image-sr/lib/python3.7/site-packages/torch/autograd/grad_mode.py", line 15, in decorate_context
    return func(*args, **kwargs)
  File "/home/navaneeth/workspace/image-super-resolution/EESRGAN/detection/engine.py", line 123, in evaluate_save
    get_prediction(outputs, file_path, config, file_name, img)
  File "/home/navaneeth/workspace/image-super-resolution/EESRGAN/detection/engine.py", line 99, in get_prediction
    draw_detection_boxes(new_class_conf_box, config, file_name, image)
  File "/home/navaneeth/workspace/image-super-resolution/EESRGAN/detection/engine.py", line 86, in draw_detection_boxes
    cv2.imwrite(dest_image_path, image)
cv2.error: OpenCV(4.4.0) /tmp/pip-req-build-njn2fp78/opencv/modules/imgcodecs/src/loadsave.cpp:738: error: (-215:Assertion failed) !_img.empty() in function 'imwrite'

themousepotato avatar Oct 23 '20 16:10 themousepotato

Generated images are stored in this location: https://github.com/Jakaria08/EESRGAN/blob/c646296f68c1158c62e6bf9eca5fc82103e4f120/detection/engine.py#L76 Make sure the directory path is ok.

Create folders to create this path: https://github.com/Jakaria08/EESRGAN/blob/c646296f68c1158c62e6bf9eca5fc82103e4f120/config_GAN.json#L112

"Test_Result_SR": "/[Your path from root]/[Your path]/[Your path]/EESRGAN/saved/Test_Result_SR/"

I don't have any GPU access now, therefore I am not able to check my code for any issue related to pytorch version mismatch or creation of some folders that are needed to store images. I will check my code in a new GPU machine soon to update the hard-coded portion and pytorch version. I will also add more documentations if possible.

Jakaria08 avatar Oct 23 '20 17:10 Jakaria08

@Jakaria08 I've checked the path and it's fine I think. Thank you for finding time to look at this. I hope you get the GPU access soon :)

themousepotato avatar Oct 23 '20 18:10 themousepotato

I'm getting this error now. I'd copied the annotation files and placed a single validation image in the folders.

(image-sr) navaneeth@mousebox:~/workspace/image-super-resolution/EESRGAN$ python test.py -c config_GAN.json
400000
[250000, 500000, 750000]
creating index...
index created!
Test:  [0/1]  eta: 0:00:01  model_time: 1.5657 (1.5657)  evaluator_time: 0.0360 (0.0360)  time: 1.7147  data: 0.1107  max mem: 651
Test: Total time: 0:00:01 (1.9105 s / it)
Averaged stats: model_time: 1.5657 (1.5657)  evaluator_time: 0.0360 (0.0360)
Accumulating evaluation results...
DONE (t=0.02s).
IoU metric: bbox
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.564
 Average Precision  (AP) @[ IoU=0.50      | area=   all | maxDets=100 ] = 0.564
 Average Precision  (AP) @[ IoU=0.75      | area=   all | maxDets=100 ] = 0.564
 Average Precision  (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.564
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.752
 Average Precision  (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = -1.000
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=  1 ] = 0.000
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets= 10 ] = 0.750
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.750
 Average Recall     (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.750
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.750
 Average Recall     (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = -1.000
Detection started........
1
Traceback (most recent call last):
  File "test.py", line 96, in <module>
    main(config)
  File "test.py", line 19, in main
    tester.test()
  File "/home/navaneeth/workspace/image-super-resolution/EESRGAN/trainer/cowc_GAN_FRCNN_trainer.py", line 38, in test
    self.model.test(self.data_loader, train=False, testResult=True)
  File "/home/navaneeth/workspace/image-super-resolution/EESRGAN/model/ESRGAN_EESN_FRCNN_Model.py", line 273, in test
    evaluate_save(self.netG, self.netFRCNN, self.targets, self.device, self.config)
  File "/home/navaneeth/anaconda3/envs/image-sr/lib/python3.7/site-packages/torch/autograd/grad_mode.py", line 15, in decorate_context
    return func(*args, **kwargs)
  File "/home/navaneeth/workspace/image-super-resolution/EESRGAN/detection/engine.py", line 123, in evaluate_save
    get_prediction(outputs, file_path, config, file_name, img)
  File "/home/navaneeth/workspace/image-super-resolution/EESRGAN/detection/engine.py", line 99, in get_prediction
    draw_detection_boxes(new_class_conf_box, config, file_name, image)
  File "/home/navaneeth/workspace/image-super-resolution/EESRGAN/detection/engine.py", line 86, in draw_detection_boxes
    cv2.imwrite(dest_image_path, image)
cv2.error: OpenCV(4.4.0) /tmp/pip-req-build-njn2fp78/opencv/modules/imgcodecs/src/loadsave.cpp:738: error: (-215:Assertion failed) !_img.empty() in function 'imwrite'

@themousepotato Did you solve this problem? I'm having the same issue. Thanks!

MrCrowbar avatar Oct 26 '20 20:10 MrCrowbar

I'm getting this error now. I'd copied the annotation files and placed a single validation image in the folders.

(image-sr) navaneeth@mousebox:~/workspace/image-super-resolution/EESRGAN$ python test.py -c config_GAN.json
400000
[250000, 500000, 750000]
creating index...
index created!
Test:  [0/1]  eta: 0:00:01  model_time: 1.5657 (1.5657)  evaluator_time: 0.0360 (0.0360)  time: 1.7147  data: 0.1107  max mem: 651
Test: Total time: 0:00:01 (1.9105 s / it)
Averaged stats: model_time: 1.5657 (1.5657)  evaluator_time: 0.0360 (0.0360)
Accumulating evaluation results...
DONE (t=0.02s).
IoU metric: bbox
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.564
 Average Precision  (AP) @[ IoU=0.50      | area=   all | maxDets=100 ] = 0.564
 Average Precision  (AP) @[ IoU=0.75      | area=   all | maxDets=100 ] = 0.564
 Average Precision  (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.564
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.752
 Average Precision  (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = -1.000
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=  1 ] = 0.000
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets= 10 ] = 0.750
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.750
 Average Recall     (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.750
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.750
 Average Recall     (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = -1.000
Detection started........
1
Traceback (most recent call last):
  File "test.py", line 96, in <module>
    main(config)
  File "test.py", line 19, in main
    tester.test()
  File "/home/navaneeth/workspace/image-super-resolution/EESRGAN/trainer/cowc_GAN_FRCNN_trainer.py", line 38, in test
    self.model.test(self.data_loader, train=False, testResult=True)
  File "/home/navaneeth/workspace/image-super-resolution/EESRGAN/model/ESRGAN_EESN_FRCNN_Model.py", line 273, in test
    evaluate_save(self.netG, self.netFRCNN, self.targets, self.device, self.config)
  File "/home/navaneeth/anaconda3/envs/image-sr/lib/python3.7/site-packages/torch/autograd/grad_mode.py", line 15, in decorate_context
    return func(*args, **kwargs)
  File "/home/navaneeth/workspace/image-super-resolution/EESRGAN/detection/engine.py", line 123, in evaluate_save
    get_prediction(outputs, file_path, config, file_name, img)
  File "/home/navaneeth/workspace/image-super-resolution/EESRGAN/detection/engine.py", line 99, in get_prediction
    draw_detection_boxes(new_class_conf_box, config, file_name, image)
  File "/home/navaneeth/workspace/image-super-resolution/EESRGAN/detection/engine.py", line 86, in draw_detection_boxes
    cv2.imwrite(dest_image_path, image)
cv2.error: OpenCV(4.4.0) /tmp/pip-req-build-njn2fp78/opencv/modules/imgcodecs/src/loadsave.cpp:738: error: (-215:Assertion failed) !_img.empty() in function 'imwrite'

@themousepotato Did you solve this problem? I'm having the same issue. Thanks!

I solved it already, if you need assitance ask me, maybe I can help you :)

MrCrowbar avatar Oct 27 '20 00:10 MrCrowbar

@MrCrowbar I haven't solved it. It would be great if you can help. Thanks for reaching out :sweat_smile:

themousepotato avatar Oct 27 '20 07:10 themousepotato

Ping @MrCrowbar just in case you've forgotten :)

themousepotato avatar Oct 29 '20 15:10 themousepotato

Hello guys! I am using Google Colab to test the algorithm with the pre-trained models. I'm having a problem where to get the validation images from. Also, in the folders 1./content/home/jakaria/Super_Resolution/Datasets/COWC/DetectionPatches_256x256/Potsdam_ISPRS/Bic/x4/valid_img 2. /content/home/jakaria/Super_Resolution/Datasets/COWC/DetectionPatches_256x256/Potsdam_ISPRS/HR/x4/valid_img 3. /content/home/jakaria/Super_Resolution/Datasets/COWC/DetectionPatches_256x256/Potsdam_ISPRS/LR/x4/valid_img

should i put only the validation image or also its .txt file?

In the understanding I got from the project tutorial, I put an HR, LR and Bic image as an example in the valid_img folders after executing the scripts_GAN_HR-LR.py algorithm and also its .txt file, otherwise it would give an error. I ask for help, because the execution result is this:

400000 [250000, 500000, 750000] creating index... index created! Test: [0/2] eta: 0:00:00 model_time: 0.4076 (0.4076) evaluator_time: 0.0020 (0.0020) time: 0.4982 data: 0.0880 max mem: 657 Test: [1/2] eta: 0:00:00 model_time: 0.1743 (0.2910) evaluator_time: 0.0019 (0.0020) time: 0.3399 data: 0.0465 max mem: 660 Test: Total time: 0:00:00 (0.3614 s / it) Averaged stats: model_time: 0.1743 (0.2910) evaluator_time: 0.0019 (0.0020) Accumulating evaluation results... DONE (t=0.00s). IoU metric: bbox Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.822 Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = 0.822 Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = 0.822 Average Precision (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.822 Average Precision (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.881 Average Precision (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = -1.000 Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 1 ] = 0.100 Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 10 ] = 0.900 Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.900 Average Recall (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.900 Average Recall (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.889 Average Recall (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = -1.000 Detection started........ 1 libpng warning: Image width is zero in IHDR libpng warning: Image height is zero in IHDR libpng error: Invalid IHDR data 2 libpng warning: Image width is zero in IHDR libpng warning: Image height is zero in IHDR libpng error: Invalid IHDR data successfully generated the results!

But when I go to the Test_Result_SR folder, the file does not open. I believe it is because of the result at the end of the execution.

brenoslinhares avatar Dec 27 '20 17:12 brenoslinhares

@MrCrowbar e @Jakaria08 help me. Thank you.

brenoslinhares avatar Dec 28 '20 16:12 brenoslinhares

Sorry for my late reply. The error you are getting is new to me. I am not sure what is happening. You need both the image and text files for evaluation. I didn't test it on google Colab. I will try to run the code on google Colab if I get time. @brenoslinhares

Jakaria08 avatar Jan 06 '21 04:01 Jakaria08

@Jakaria08, I noticed that the line of code that is making the matrix error with number of rows and columns equal to zero is this:

def draw_detection_boxes(new_class_conf_box, config, file_name, image): source_image_path = os.path.join(config['path']['output_images'], file_name, file_name+'_112000_final_SR.png')

Could you please inform me, how to generate the images for this path?

Thanks!

brenoslinhares avatar Jan 24 '21 22:01 brenoslinhares

@MrCrowbar, Could you tell me how you fixed your problem in the code, as reported above?

brenoslinhares avatar Jan 25 '21 01:01 brenoslinhares

I just noticed that my error was a little different. For me, it's self.annotation which is empty. Could you please elaborate on how are we generating the validation set? I'd done generate_mod_LR_bic() of scripts_GAN_HR-LR.py (Running other functions leads to error since I don't have all the data). All the data was with me other than /home/jakaria/Super_Resolution/Filter_Enhance_Detect/saved/*.

From the pretrainied weights, I was able to get the following:

        "pretrain_model_G": "/home/jakaria/Super_Resolution/Filter_Enhance_Detect/saved/pretrained_models_EESRGAN_FRCNN/170000_G.pth",
        "pretrain_model_D": "/home/jakaria/Super_Resolution/Filter_Enhance_Detect/saved/pretrained_models_EESRGAN_FRCNN/170000_D.pth",
        "pretrain_model_FRCNN": "/home/jakaria/Super_Resolution/Filter_Enhance_Detect/saved/pretrained_models_EESRGAN_FRCNN/170000_FRCNN.pth",

What should I do for the data other than this in `/home/jakaria/Super_Resolution/Filter_Enhance_Detect/saved/*? @Jakaria08 @jinzhenmu

Edit: I'm trying to reproduce the results using pretrained weights FYI

Has the problem you mentioned been resolved?

Lee-Gao avatar Mar 14 '21 12:03 Lee-Gao

21-05-13 21:01:15.778 - INFO: Loading model for G [saved/pretrained_models_EESRGAN_FRCNN/170000_G.pth] ... 21-05-13 21:01:15.891 - INFO: Loading model for D [saved/pretrained_models_EESRGAN_FRCNN/170000_D.pth] ... 21-05-13 21:01:15.926 - INFO: Loading model for D [saved/pretrained_models_EESRGAN_FRCNN/170000_FRCNN.pth] ... 21-05-13 21:01:16.002 - INFO: Number of train images: 1,338, iters: 669 21-05-13 21:01:16.002 - INFO: Total epochs needed: 598 for iters 400,000 21-05-13 21:01:16.034 - INFO: Start training from epoch: 0, iter: 0 Traceback (most recent call last): File "train.py", line 94, in <module> main(config) File "train.py", line 73, in main trainer.train() File "/mnt/6adf827a-6bba-4144-8bbb-298f8389ce17/aerial-object-detection/EESRGAN/trainer/cowc_GAN_FRCNN_trainer.py", line 74, in train for _, (image, targets) in enumerate(self.data_loader): File "/home/rakesh/anaconda3/envs/aerial/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 517, in __next__ data = self._next_data() File "/home/rakesh/anaconda3/envs/aerial/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 1199, in _next_data return self._process_data(data) File "/home/rakesh/anaconda3/envs/aerial/lib/python3.7/site-packages/torch/utils/data/dataloader.py", line 1225, in _process_data data.reraise() File "/home/rakesh/anaconda3/envs/aerial/lib/python3.7/site-packages/torch/_utils.py", line 429, in reraise raise self.exc_type(msg) cv2.error: Caught error in DataLoader worker process 0. Original Traceback (most recent call last): File "/home/rakesh/anaconda3/envs/aerial/lib/python3.7/site-packages/torch/utils/data/_utils/worker.py", line 202, in _worker_loop data = fetcher.fetch(index) File "/home/rakesh/anaconda3/envs/aerial/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch data = [self.dataset[idx] for idx in possibly_batched_index] File "/home/rakesh/anaconda3/envs/aerial/lib/python3.7/site-packages/torch/utils/data/_utils/fetch.py", line 44, in <listcomp> data = [self.dataset[idx] for idx in possibly_batched_index] File "/mnt/6adf827a-6bba-4144-8bbb-298f8389ce17/aerial-object-detection/EESRGAN/scripts_for_datasets/COWC_EESRGAN_FRCNN_dataset.py", line 36, in __getitem__ img_gt = cv2.cvtColor(img_gt, cv2.COLOR_BGR2RGB) cv2.error: OpenCV(4.5.2) /tmp/pip-req-build-5wrl9sz4/opencv/modules/imgproc/src/color.cpp:182: error: (-215:Assertion failed) !_src.empty() in function 'cvtColor' Did someone solved this?

RakeshRaj97 avatar May 13 '21 11:05 RakeshRaj97

Hello guys! I am using Google Colab to test the algorithm with the pre-trained models. I'm having a problem where to get the validation images from. Also, in the folders 1./content/home/jakaria/Super_Resolution/Datasets/COWC/DetectionPatches_256x256/Potsdam_ISPRS/Bic/x4/valid_img 2. /content/home/jakaria/Super_Resolution/Datasets/COWC/DetectionPatches_256x256/Potsdam_ISPRS/HR/x4/valid_img 3. /content/home/jakaria/Super_Resolution/Datasets/COWC/DetectionPatches_256x256/Potsdam_ISPRS/LR/x4/valid_img

should i put only the validation image or also its .txt file?

In the understanding I got from the project tutorial, I put an HR, LR and Bic image as an example in the valid_img folders after executing the scripts_GAN_HR-LR.py algorithm and also its .txt file, otherwise it would give an error. I ask for help, because the execution result is this:

400000 [250000, 500000, 750000] creating index... index created! Test: [0/2] eta: 0:00:00 model_time: 0.4076 (0.4076) evaluator_time: 0.0020 (0.0020) time: 0.4982 data: 0.0880 max mem: 657 Test: [1/2] eta: 0:00:00 model_time: 0.1743 (0.2910) evaluator_time: 0.0019 (0.0020) time: 0.3399 data: 0.0465 max mem: 660 Test: Total time: 0:00:00 (0.3614 s / it) Averaged stats: model_time: 0.1743 (0.2910) evaluator_time: 0.0019 (0.0020) Accumulating evaluation results... DONE (t=0.00s). IoU metric: bbox Average Precision (AP) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.822 Average Precision (AP) @[ IoU=0.50 | area= all | maxDets=100 ] = 0.822 Average Precision (AP) @[ IoU=0.75 | area= all | maxDets=100 ] = 0.822 Average Precision (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.822 Average Precision (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.881 Average Precision (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = -1.000 Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 1 ] = 0.100 Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets= 10 ] = 0.900 Average Recall (AR) @[ IoU=0.50:0.95 | area= all | maxDets=100 ] = 0.900 Average Recall (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.900 Average Recall (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.889 Average Recall (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = -1.000 Detection started........ 1 libpng warning: Image width is zero in IHDR libpng warning: Image height is zero in IHDR libpng error: Invalid IHDR data 2 libpng warning: Image width is zero in IHDR libpng warning: Image height is zero in IHDR libpng error: Invalid IHDR data successfully generated the results!

But when I go to the Test_Result_SR folder, the file does not open. I believe it is because of the result at the end of the execution.

Hi , I am also getting the same error, Did you solve your issue?

bibuzz avatar May 18 '21 07:05 bibuzz

File "/home/gfzx/yjg/EESRGAN-master/scripts_for_datasets/COWC_EESRGAN_FRCNN_dataset.py", line 36, in getitem annotation_path = os.path.join(self.data_dir_lq, self.annotation[idx])

please!!!! i can not get the "annotation_path", its value is empty, how can i get it ????

yjg123456 avatar May 25 '21 08:05 yjg123456

I'm getting this error now. I'd copied the annotation files and placed a single validation image in the folders.

(image-sr) navaneeth@mousebox:~/workspace/image-super-resolution/EESRGAN$ python test.py -c config_GAN.json
400000
[250000, 500000, 750000]
creating index...
index created!
Test:  [0/1]  eta: 0:00:01  model_time: 1.5657 (1.5657)  evaluator_time: 0.0360 (0.0360)  time: 1.7147  data: 0.1107  max mem: 651
Test: Total time: 0:00:01 (1.9105 s / it)
Averaged stats: model_time: 1.5657 (1.5657)  evaluator_time: 0.0360 (0.0360)
Accumulating evaluation results...
DONE (t=0.02s).
IoU metric: bbox
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.564
 Average Precision  (AP) @[ IoU=0.50      | area=   all | maxDets=100 ] = 0.564
 Average Precision  (AP) @[ IoU=0.75      | area=   all | maxDets=100 ] = 0.564
 Average Precision  (AP) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.564
 Average Precision  (AP) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.752
 Average Precision  (AP) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = -1.000
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=  1 ] = 0.000
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets= 10 ] = 0.750
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=   all | maxDets=100 ] = 0.750
 Average Recall     (AR) @[ IoU=0.50:0.95 | area= small | maxDets=100 ] = 0.750
 Average Recall     (AR) @[ IoU=0.50:0.95 | area=medium | maxDets=100 ] = 0.750
 Average Recall     (AR) @[ IoU=0.50:0.95 | area= large | maxDets=100 ] = -1.000
Detection started........
1
Traceback (most recent call last):
  File "test.py", line 96, in <module>
    main(config)
  File "test.py", line 19, in main
    tester.test()
  File "/home/navaneeth/workspace/image-super-resolution/EESRGAN/trainer/cowc_GAN_FRCNN_trainer.py", line 38, in test
    self.model.test(self.data_loader, train=False, testResult=True)
  File "/home/navaneeth/workspace/image-super-resolution/EESRGAN/model/ESRGAN_EESN_FRCNN_Model.py", line 273, in test
    evaluate_save(self.netG, self.netFRCNN, self.targets, self.device, self.config)
  File "/home/navaneeth/anaconda3/envs/image-sr/lib/python3.7/site-packages/torch/autograd/grad_mode.py", line 15, in decorate_context
    return func(*args, **kwargs)
  File "/home/navaneeth/workspace/image-super-resolution/EESRGAN/detection/engine.py", line 123, in evaluate_save
    get_prediction(outputs, file_path, config, file_name, img)
  File "/home/navaneeth/workspace/image-super-resolution/EESRGAN/detection/engine.py", line 99, in get_prediction
    draw_detection_boxes(new_class_conf_box, config, file_name, image)
  File "/home/navaneeth/workspace/image-super-resolution/EESRGAN/detection/engine.py", line 86, in draw_detection_boxes
    cv2.imwrite(dest_image_path, image)
cv2.error: OpenCV(4.4.0) /tmp/pip-req-build-njn2fp78/opencv/modules/imgcodecs/src/loadsave.cpp:738: error: (-215:Assertion failed) !_img.empty() in function 'imwrite'

@themousepotato Did you solve this problem? I'm having the same issue. Thanks!

hello , my question is the "annotation_path", its value is empty, can you help me solve it ? thank you!!!

yjg123456 avatar May 25 '21 08:05 yjg123456

@brenoslinhares I have the same problem. I found that there is no code for generating images in output_images. 'output_images' is only mentioned in engine.py. I think the code is incomplete.

spacewalk01 avatar Jul 13 '21 07:07 spacewalk01