amdegroot / ssd.pytorch

A PyTorch Implementation of Single Shot MultiBox Detector
MIT License
5.09k stars 1.74k forks source link

ssd_net vs net #273

Open croros opened 5 years ago

croros commented 5 years ago

In train.py there is the following line: net = ssd_net And both net and ssd_net are used in the lines following this one.

From my understanding net is a shallow copy of of ssd_net. Is there a reason to use both? Just seems to be more confusing to use two different names for the same data (unless I am missing something)

Antoine-ls commented 5 years ago

the same question as you, if I load trained model, it seems that it is loaded into ssd_net, while we continue to train net...

tetsu-kikuchi commented 3 years ago

My personal opinion is that the use of two different names is related to nn.DataParallel.
I don't know precisely, but when we use nn.DataParallel, sometimes data loading and saving become problematic.
So, to avoid such a problem, in the code ssd_net is used only for loading, saving, initializing etc., while net is wrapped by net = torch.nn.Dataparallel(ssd_net) and is used only for training and evaluation.