Skip to content

Commit

Permalink
remove manual no_grad and train mode
Browse files Browse the repository at this point in the history
  • Loading branch information
aniketmaurya committed May 16, 2022
1 parent 3dbbb44 commit 13bb3e7
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions icevision/models/ultralytics/yolov5/lightning/model_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,15 @@ def training_step(self, batch, batch_idx):
def validation_step(self, batch, batch_idx):
(xb, yb), records = batch

with torch.no_grad():
inference_out, training_out = self(xb)
preds = yolov5.convert_raw_predictions(
batch=xb,
raw_preds=inference_out,
records=records,
detection_threshold=0.001,
nms_iou_threshold=0.6,
)
loss = self.compute_loss(training_out, yb)[0]
inference_out, training_out = self(xb)
preds = yolov5.convert_raw_predictions(
batch=xb,
raw_preds=inference_out,
records=records,
detection_threshold=0.001,
nms_iou_threshold=0.6,
)
loss = self.compute_loss(training_out, yb)[0]

self.accumulate_metrics(preds)

Expand Down

0 comments on commit 13bb3e7

Please sign in to comment.