amdegroot / ssd.pytorch

A PyTorch Implementation of Single Shot MultiBox Detector
MIT License
5.15k stars 1.75k forks source link

SSD - object detection #465

Open RanushMithila opened 4 years ago

RanushMithila commented 4 years ago

this is the course "[DesireCourse.Net] Udemy - Deep Learning and Computer Vision A-Z™ OpenCV, SSD & GANs" .I'm learning this course but I got this error..how to fi it

runfile('F:/openCV Udemy practical/Computer_Vision_A_Z_Template_Folder/Module 2 - Object Detection/object_detection.py', wdir='F:/openCV Udemy practical/Computer_Vision_A_Z_Template_Folder/Module 2 - Object Detection') F:\openCV Udemy practical\Computer_Vision_A_Z_Template_Folder\Module 2 - Object Detection\ssd.py:33: UserWarning: volatile was removed and now has no effect. Use with torch.no_grad(): instead. self.priors = Variable(self.priorbox.forward(), volatile=True) F:\openCV Udemy practical\Computer_Vision_A_Z_TemplateFolder\Module 2 - Object Detection\layers\modules\l2norm.py:17: UserWarning: nn.init.constant is now deprecated in favor of nn.init.constant. init.constant(self.weight,self.gamma) Traceback (most recent call last):

File "F:\openCV Udemy practical\Computer_Vision_A_Z_Template_Folder\Module 2 - Object Detection\object_detection.py", line 42, in frame = detect(frame, net.eval(), transform)

File "F:\openCV Udemy practical\Computer_Vision_A_Z_Template_Folder\Module 2 - Object Detection\object_detection.py", line 17, in detect y = net(x)

File "C:\Users\Ranush Mithila.conda\envs\virtual_platform\lib\site-packages\torch\nn\modules\module.py", line 532, in call result = self.forward(*input, **kwargs)

File "F:\openCV Udemy practical\Computer_Vision_A_Z_Template_Folder\Module 2 - Object Detection\ssd.py", line 101, in forward self.priors.type(type(x.data)) # default boxes

File "F:\openCV Udemy practical\Computer_Vision_A_Z_Template_Folder\Module 2 - Object Detection\layers\functions\detection.py", line 63, in forward ids, count = nms(boxes, scores, self.nms_thresh, self.top_k)

ValueError: not enough values to unpack (expected 2, got 0)

I'm run this code in spyder(python 3.6)

isiddharthsingh commented 4 years ago

detection.py line 49 indtead "if scores.dim() == 0:" with " if scores.size(0)==0:"

RanushMithila commented 4 years ago

detection.py line 49 indtead "if scores.dim() == 0:" with " if scores.size(0)==0:"

it is didn't work sir Now I come this error

runfile('F:/openCV Udemy practical/Computer_Vision_A_Z_Template_Folder/Module 2 - Object Detection/object_detection.py', wdir='F:/openCV Udemy practical/Computer_Vision_A_Z_Template_Folder/Module 2 - Object Detection') Reloaded modules: data, data.voc0712, data.config, ssd, layers, layers.functions, layers.functions.detection, layers.box_utils, layers.functions.prior_box, layers.modules, layers.modules.l2norm, layers.modules.multibox_loss F:\openCV Udemy practical\Computer_Vision_A_Z_Template_Folder\Module 2 - Object Detection\ssd.py:33: UserWarning: volatile was removed and now has no effect. Use with torch.no_grad(): instead. self.priors = Variable(self.priorbox.forward(), volatile=True) F:\openCV Udemy practical\Computer_Vision_A_Z_TemplateFolder\Module 2 - Object Detection\layers\modules\l2norm.py:17: UserWarning: nn.init.constant is now deprecated in favor of nn.init.constant. init.constant(self.weight,self.gamma) Traceback (most recent call last):

File "F:\openCV Udemy practical\Computer_Vision_A_Z_Template_Folder\Module 2 - Object Detection\object_detection.py", line 32, in net.load_state_dict(torch.load('ssd300_mAP_77.43_v2.pth', map_location = lambda storage, loc: storage))

File "C:\ProgramData\Anaconda3\lib\site-packages\torch\serialization.py", line 525, in load with _open_file_like(f, 'rb') as opened_file:

File "C:\ProgramData\Anaconda3\lib\site-packages\torch\serialization.py", line 212, in _open_file_like return _open_file(name_or_buffer, mode)

File "C:\ProgramData\Anaconda3\lib\site-packages\torch\serialization.py", line 193, in init super(_open_file, self).init(open(name, mode))

FileNotFoundError: [Errno 2] No such file or directory: 'ssd300_mAP_77.43_v2.pth'

isiddharthsingh commented 4 years ago

The course you are doing requires these. So create a new environment and install these: python version 3.6.10 pytorch version 0.3.1 torchvision version 0.1.6 pillow version 7.1.1 opencv-contrib-python version 4.2.0.34 opencv-python 4.2.0.34

I tried these and it was working.