rohitgajawada / Where-are-they-looking-PyTorch

Where are they looking? - Gaze Following via Attention modelling and Deep Learning
MIT License
35 stars 10 forks source link

Implementation of best = 1000000000 . How it relates to euclid_mindist? #6

Open BhuvaneshwariBhaskaran opened 5 years ago

BhuvaneshwariBhaskaran commented 5 years ago

I was trying to train a model but getting an error for euclid_mindist line 114 in utils.py.

I used epocs 40 and reduced the train.mat file to 5000 images.

Error: Bool value of Tensor with more than one value is ambiguous

`for i in range(l):

    best = 1000000000

    predy = ((output[i] / 227.0) / 227.0) 
    predx = ((output[i] % 227.0) / 227.0) 

    ct = 0
    for j in range(100):
        ground_x = target[i][2*j]
        ground_y = target[i][2*j + 1]
        if ground_x == -1 or ground_y == -1:
            break

        temp = np.sqrt(np.power((ground_x - predx), 2) + np.power((ground_y - predy), 2))

        if temp < best:
            best = temp
        ct += 1

    fulltotal += best

fulltotal = fulltotal / float(l * 1.0)
return fulltotal`

It would be great if you can give me a brief of about implementation of this logic with best = 1000000000.

robert1015 commented 4 years ago

I was trying to train a model but getting an error for euclid_mindist line 114 in utils.py.

I used epocs 40 and reduced the train.mat file to 5000 images.

Error: Bool value of Tensor with more than one value is ambiguous

`for i in range(l):

    best = 1000000000

    predy = ((output[i] / 227.0) / 227.0) 
    predx = ((output[i] % 227.0) / 227.0) 

    ct = 0
    for j in range(100):
        ground_x = target[i][2*j]
        ground_y = target[i][2*j + 1]
        if ground_x == -1 or ground_y == -1:
            break

        temp = np.sqrt(np.power((ground_x - predx), 2) + np.power((ground_y - predy), 2))

        if temp < best:
            best = temp
        ct += 1

    fulltotal += best

fulltotal = fulltotal / float(l * 1.0)
return fulltotal`

It would be great if you can give me a brief of about implementation of this logic with best = 1000000000.

I also face this error. May I ask you how you dealt with the error finally please?

prathmeshrmadhu commented 4 years ago

Facing the same issue Error: Bool value of Tensor with more than one value is ambiguous . Can someone help?

zrSKY98 commented 4 years ago

I also facing the same issue.Can someone help?

zrSKY98 commented 4 years ago

Facing the same issue Error: Bool value of Tensor with more than one value is ambiguous . Can someone help?

May I ask you how you dealt with the error please?

le-wei commented 4 years ago

@zrSKY98 @prathmeshrmadhu @robert1015 I tried to solve this problem, I modified the return value of the predict() inmodels / gazennet.py ==> return hm_base.view (-1, 227 * 227)