AlessioGalluccio / FastFlow

an implementation of the architecture of FastFlow (Jiawei Yu et al.)
MIT License
40 stars 13 forks source link

The problem when I launch the project #2

Closed simo-an closed 2 years ago

simo-an commented 2 years ago

When I launch the project via "python main.py", I got the error message as fellowing:

Traceback (most recent call last):
  File "main.py", line 29, in <module>
    model = train(train_loader, test_loader)
  File "/home/temporary/simu/object-detection/FastFlow/train.py", line 116, in train
    if test_labels[i] == 0: # label value of good TODO eliminate magic numbers
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

The error occured in this code

        # evaluate

                test_loss.append(t2np(loss))
                test_labels.append(t2np(labels))

        test_loss_good = list()
        test_loss_defective = list()
        '''
                 Error occured Here
        '''
        for i in range(len(test_labels)): 
            if test_labels[i] == 0: # label value of good TODO eliminate magic numbers
                test_loss_good.append(test_loss[i])
            else:
                test_loss_defective.append(-test_loss[i])

As I print the test_labels[i], I got an array like [0, 2]

So, what should I do to launch this project? Thanks!

wz940216 commented 2 years ago

I directly blocked these codes without affecting the training