taohan10200 / IIM

PyTorch implementations of the paper: "Learning Independent Instance Maps for Crowd Localization"
MIT License
169 stars 41 forks source link

UserWarning: Corrupt EXIF data. Expecting to read 4 bytes but only got 2. warnings.warn(str(msg)) #4

Closed ZJU-lishuang closed 3 years ago

ZJU-lishuang commented 3 years ago

When using img = Image.open(0440.jpg),there is the warning. How to fix it?

gjy3035 commented 3 years ago

This warning does not affect the training process. The image data may be corrupted in Linux. If you fix it, you should re-read and rewrite each image in Windows using OpenCV or Matlab.

ZJU-lishuang commented 3 years ago

How to generate val_gt_loc.txt? I don't find the relative code in this project.

gjy3035 commented 3 years ago

It is just an auxiliary file for visualization and offline evaluation. If you need it, we will upload it ASAP.

Thanks for your attention!

ZJU-lishuang commented 3 years ago

I have converted SHHB to NWPU format.But when I train the dataset,the val_loader need the val_gt_loc.txt file.

ZJU-lishuang commented 3 years ago
sigma_s = gt_data['sigma'][:,0]
sigma_l = gt_data['sigma'][:,1]

What is the meaning of the sigma parameter?

gjy3035 commented 3 years ago
sigma_s = gt_data['sigma'][:,0]
sigma_l = gt_data['sigma'][:,1]

What is the meaning of the sigma parameter?

Please see the NWPU-Crowd paper for the details.

gjy3035 commented 3 years ago

I have converted SHHB to NWPU format.But when I train the dataset,the val_loader need the val_gt_loc.txt file.

Shanghai A and B's processed data and parameters will be upload in 2 days. I have been busy graduating in recent days, please understand.

ZJU-lishuang commented 3 years ago

How about the mae/mse in the Shanghai B?

gjy3035 commented 3 years ago

best loc model: F1 of ~86%, MAE/MSE of ~15/~33 best cnt model: F1 of ~85%, MAE/MSE of ~11/~25

gjy3035 commented 3 years ago

I have converted SHHB to NWPU format.But when I train the dataset,the val_loader need the val_gt_loc.txt file.

The SHHA/B's training parameters have been uploaded in this repo ./saved_exp_results and the processed data is available at https://mailnwpueducn-my.sharepoint.com/:f:/g/personal/gjy3035_mail_nwpu_edu_cn/EliCeOckaZVBgez6n8ZWvr4BNdwPauFJgbm88MGhHid25w?e=rtogwc .

Thanks for your attention!

maraoz commented 2 years ago

In case this helps anyone in the future, here's how I removed all EXIF data from my dataset, which removed the PIL warnings.

# remove corrupt exif data

from PIL import Image

file_names = get_image_files(path)

def remove_exif(image_name):
    image = Image.open(image_name)
    if not image.getexif():
        return
    print('removing EXIF from', image_name, '...')
    data = list(image.getdata())
    image_without_exif = Image.new(image.mode, image.size)
    image_without_exif.putdata(data)

    image_without_exif.save(image_name)

for file in file_names:
    remove_exif(file)
print('done')
taohan10200 commented 2 years ago

@maraoz Thanks for your share!