Event-AHU / OpenPAR

[OpenPAR] An open-source framework for Pedestrian Attribute Recognition, based on PyTorch
MIT License
79 stars 11 forks source link

new test_example.py. #12

Closed jerryum closed 8 months ago

jerryum commented 8 months ago

first of all, thank you to upload test_example.py in PromptPAR

When I tested the model using test_example.py, I learned several things for the model.

datasets_attrnum={'PA100k':26,'RAPV1':51,'PETA':35,'PETAzs':35,'UPAR':40,'RAPzs':53,'RAPV2':54,'WIDER':14,"RAPV1Expand":51}

from scipy.io import loadmat import os save_dir = '/home/jerryum/works/OpenPAR/dataset/PETA/' peta_data = loadmat(os.path.join(save_dir, 'PETA.mat')) raw_attr_name = [i[0][0] for i in peta_data['peta'][0][0][1]] raw_label = peta_data['peta'][0][0][0][:, 4:]

print (len(raw_attr_name)) print (raw_label.shape) 105 (19000, 105)

IndexError: index 35 is out of bounds for axis 0 with size 35

jerryum commented 8 months ago

I changed the attributes like below - same as the list from peta_pad.py and got a successful outcome.. Also, had to deal with several minor issues... FYI.

attributes = [
    'A pedestrian wearing a hat', 'A pedestrian wearing a muffler', 'A pedestrian with no headwear', 'A pedestrian wearing sunglasses', 'A pedestrian with long hair',
    'A pedestrian in casual upper wear', 'A pedestrian in formal upper wear', 'A pedestrian in a jacket', 'A pedestrian in upper wear with a logo', 'A pedestrian in plaid upper wear',
    'A pedestrian in a short-sleeved top', 'A pedestrian in upper wear with thin stripes', 'A pedestrian in a t-shirt', 'A pedestrian in other upper wear', 'A pedestrian in upper wear with a V-neck',
    'A pedestrian in casual lower wear', 'A pedestrian in formal lower wear', 'A pedestrian in jeans', 'A pedestrian in shorts', 'A pedestrian in a short skirt', 'A pedestrian in trousers',
    'A pedestrian in leather shoes', 'A pedestrian in sandals', 'A pedestrian in other types of shoes', 'A pedestrian in sneakers',
    'A pedestrian with a backpack', 'A pedestrian with other types of attachments', 'A pedestrian with a messenger bag', 'A pedestrian with no attachments', 'A pedestrian with plastic bags',
    'A pedestrian under the age of 30', 'A pedestrian between the ages of 30 and 45', 'A pedestrian between the ages of 45 and 60', 'A pedestrian over the age of 60',
    'A male pedestrian'
]
1125178969 commented 8 months ago

The reason why only 35 of PETA's 105 attributes are chosen is because the other attributes have lower positive ratios, where we follow the settings given in the PETA paper

1125178969 commented 8 months ago

Thanks for the correction.

jerryum commented 8 months ago

Thanks for the confirmation! By the way, the project is extremely helpful for me to understand the algorithm of the PAR....