Skip to content

Commit

Permalink
sets model to eval mode (required due to batchnorm layer)
Browse files Browse the repository at this point in the history
  • Loading branch information
ranahanocka committed Aug 18, 2018
1 parent 75dd61c commit 4df9208
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions train_classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
points = points.transpose(2,1)
points, target = points.cuda(), target.cuda()
optimizer.zero_grad()
classifier = classifier.train()
pred, _ = classifier(points)
loss = F.nll_loss(pred, target)
loss.backward()
Expand All @@ -88,6 +89,7 @@
points, target = Variable(points), Variable(target[:,0])
points = points.transpose(2,1)
points, target = points.cuda(), target.cuda()
classifier = classifier.eval()
pred, _ = classifier(points)
loss = F.nll_loss(pred, target)
pred_choice = pred.data.max(1)[1]
Expand Down
4 changes: 3 additions & 1 deletion train_segmentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
points = points.transpose(2,1)
points, target = points.cuda(), target.cuda()
optimizer.zero_grad()
classifier = classifier.train()
pred, _ = classifier(points)
pred = pred.view(-1, num_classes)
target = target.view(-1,1)[:,0] - 1
Expand All @@ -87,7 +88,8 @@
points, target = data
points, target = Variable(points), Variable(target)
points = points.transpose(2,1)
points, target = points.cuda(), target.cuda()
points, target = points.cuda(), target.cuda()
classifier = classifier.eval()
pred, _ = classifier(points)
pred = pred.view(-1, num_classes)
target = target.view(-1,1)[:,0] - 1
Expand Down

0 comments on commit 4df9208

Please sign in to comment.