takiyu / hyperface

Deep Neural Network (DNN) which predicts face/non-face, landmarks, pose and gender simultaneously with Chainer.
MIT License
176 stars 45 forks source link

ValueError: train argument is not supported anymore #15

Open sbharadwajj opened 5 years ago

sbharadwajj commented 5 years ago

Hi, @takiyu I'm running the use_on_file.py like this python scripts/use_on_file.py --model model_epoch_190 --img age_gender/input/jan2.jpg

The error I'm getting is this:

Traceback (most recent call last):
  File "scripts/use_on_file.py", line 87, in <module>
    y = model(x)
  File "/datadrive/hyperface/scripts/models.py", line 80, in __call__
    h = F.dropout(h, train=self.train)
  File "/datadrive/virtualenvs/py2/local/lib/python2.7/site-packages/chainer/functions/noise/dropout.py", line 163, in dropout
    kwargs, train='train argument is not supported anymore. '
  File "/datadrive/virtualenvs/py2/local/lib/python2.7/site-packages/chainer/utils/argument.py", line 7, in check_unexpected_kwargs
    raise ValueError(message)
ValueError: train argument is not supported anymore. Use chainer.using_config

The model is successfully running till this step: [2018/10/12 04:45:15] INFO (4127) __main__ : Forward the network

Is there some step I'm missing out?

sbharadwajj commented 5 years ago

Hi, I fixed it by changing this in the models.py file

with chainer.using_config('train', False):
            h = F.dropout(h)
            h_detection = F.relu(self.fc_detection1(h))
            h_detection = F.dropout(h_detection)
            h_detection = self.fc_detection2(h_detection)
            h_landmark = F.relu(self.fc_landmarks1(h))
            h_landmark = F.dropout(h_landmark)
            h_landmark = self.fc_landmarks2(h_landmark)
            h_visibility = F.relu(self.fc_visibility1(h))
            h_visibility = F.dropout(h_visibility)
            h_visibility = self.fc_visibility2(h_visibility)
            h_pose = F.relu(self.fc_pose1(h))
            h_pose = F.dropout(h_pose)
            h_pose = self.fc_pose2(h_pose)
            h_gender = F.relu(self.fc_gender1(h))
            h_gender = F.dropout(h_gender)
            h_gender = self.fc_gender2(h_gender)

But i'm unable to draw the rectangles around the predicted results for gender.

Adblu commented 1 year ago

@sbharadwajj could you please share your python environment ? I cannot start training with full cuda (cupy) support