You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, i am trying to run your efficient det on my custom dataset. In thee forward pass TypeError: forward() missing 1 required positional argument: 'target' is thrown. I would kindly ask for your help with this issue.
This is how i call the forward pass from within the pytorch lightning framework:
def training_step(self, batch, batch_idx):
images, targets = batch
targets = [{k: v for k, v in t.items()} for t in targets]
# separate losses
images = torch.stack(images).float()
targets2 = {}
targets2["bbox"] = [
target["boxes"].float() for target in targets
] # variable number of instances, so the entire structure can be forced to tensor
targets2["cls"] = [target["labels"].float() for target in targets]
targets2["image_id"] = torch.tensor(
[target["image_id"] for target in targets]
).float()
targets2["img_scale"] = torch.tensor(
[target["img_scale"] for target in targets]
).float()
targets2["img_size"] = torch.tensor(
[(IMG_SIZE, IMG_SIZE) for target in targets]
).float()
print('targets2:')
print(targets2)
print('type of dict: ', type(targets2))
losses_dict = self.forward(images, targets2)
return {"loss": losses_dict["loss"], "log": losses_dict}
This discussion was converted from issue #206 on April 12, 2021 19:13.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, i am trying to run your efficient det on my custom dataset. In thee forward pass
TypeError: forward() missing 1 required positional argument: 'target'
is thrown. I would kindly ask for your help with this issue.This is how i instantiate the model:
This is how i call the forward pass from within the pytorch lightning framework:
Printed targets2:
{'bbox': [tensor([[139.1957, 137.6129, 210.4661, 204.0420]])], 'cls': [tensor([[0., 0., 0., 1., 0., 0., 0., 0.]])], 'image_id': tensor([47727.]), 'img_scale': tensor([1.]), 'img_size': tensor([[256., 256.]])}
The full callstack is:
Desktop (please complete the following information):
Beta Was this translation helpful? Give feedback.
All reactions