uoip / ssd-variants Goto Github PK
View Code? Open in Web Editor NEWPyTorch implementation of several SSD based object detection algorithms.
License: MIT License
PyTorch implementation of several SSD based object detection algorithms.
License: MIT License
We trained an SSD model using this repo and we report map =74% only. Any reason for that?
Hello.
I've tried to run this code with
python train.py --cuda --voc_root ~/data/VOCdevkit --batch_size 16 --backbone ./vgg16_reducedfc.pth
but it occurs errors below
argparser: Namespace(backbone='./vgg16_reducedfc.pth', batch_size=16, checkpoint='', cuda=True, demo=False, lr=0.001, seed=233, start_iter=0, test=False, threads=4, voc_root='/home/han/data/VOCdevkit') ./models/SSD.py:22: UserWarning: nn.init.constant is now deprecated in favor of nn.init.constant_. nn.init.constant(self.weight, scale) ./models/SSD.py:111: UserWarning: nn.init.xavier_uniform is now deprecated in favor of nn.init.xavier_uniform_. nn.init.xavier_uniform(m.weight.data) Backbone loaded! /home/han/virtualenv/py36/lib/python3.6/site-packages/torch/nn/functional.py:52: UserWarning: size_average and reduce args will be deprecated, please use reduction='sum' instead. warnings.warn(warning.format(ret)) Traceback (most recent call last): File "train.py", line 268, in <module> train() File "train.py", line 149, in train loss.backward() File "/home/han/virtualenv/py36/lib/python3.6/site-packages/torch/tensor.py", line 93, in backward torch.autograd.backward(self, gradient, retain_graph, create_graph) File "/home/han/virtualenv/py36/lib/python3.6/site-packages/torch/autograd/__init__.py", line 90, in backward allow_unreachable=True) # allow_unreachable flag
RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation
So, I changed all the inplace=True
options in SSD.py
For example in line 81,
from x = F.relu(m(x), inplace=True)
to x = F.relu(m(x), inplace=False)
.
But it occurs same error.
Is there any solution?
my environment is exactly same with required environment.
(python3.6 with other requirements)
I have noted that this implementation bring some box assignments in ssd.pytorch from GPU to CPU. The dataset return preprocessed bboxes (bboxes.shape=[8732, 4]) instead of ground-truth boxes. In my case, transform progress in my costumed dataset is about 10 times slower than one in original pascal voc. That cause my GPUs keep starving for low CPU data processing.
I printed the transform time by time library in python3. Here are the contradistinction:
Both transform time calculated by following codes:
t0 = time.time()
if self.transform is not None:
img, bboxes = self.transform(img, bboxes)
t1 = time.time()
delta = t1 - t0
print('sec', delta%60)
In Pascal VOC:
In my dataset:
Of cause, I have already check other part's cost time in getitem method, they are pretty much closed, details will not be presented.
The only reason I can directly recall is the different image sizes between two datasets. VOC's image shape is around (375, 500, 3), (500, 334, 3) [cv2.imread, HWC], but my dataset images' size is like (1080, 1920, 3), (1078, 1916, 3), (1500, 2000, 3), which are much bigger than VOC's.
Is there any other possible reason? Transform is kind of too complex for me. Please help me accelerate my dataloader! THINKS!
Hi,
basically what the title says...
Could you provide a simple gist to train blitznet?
Thanks in advance
ValueError: Expected more than 1 value per channel when training, got input size torch.Size([1, 256, 1, 1])
When I change the "SSD" to "DSOD", the error occured. Could you tell me how could I solve it?
DId anyone manage to report the map=77.6% for DSOD model using this repo?
running train.py as followed encounter the error
(pytorch_p27) [ec2-user@ip-172-31-37-28 SSD-variants]$ python train.py --demo --voc_root /VOCdevkit --checkpoint vgg16_reducedfc.pth
File "train.py", line 27, in
from tensorboardX import SummaryWriter
File "/home/ec2-user/anaconda3/envs/pytorch_p27/lib/python2.7/site-packages/tensorboardX/init.py", line 5, in
from .torchvis import TorchVis
File "/home/ec2-user/anaconda3/envs/pytorch_p27/lib/python2.7/site-packages/tensorboardX/torchvis.py", line 11, in
from .writer import SummaryWriter
File "/home/ec2-user/anaconda3/envs/pytorch_p27/lib/python2.7/site-packages/tensorboardX/writer.py", line 27, in
from .event_file_writer import EventFileWriter
File "/home/ec2-user/anaconda3/envs/pytorch_p27/lib/python2.7/site-packages/tensorboardX/event_file_writer.py", line 28, in
from .proto import event_pb2
File "/home/ec2-user/anaconda3/envs/pytorch_p27/lib/python2.7/site-packages/tensorboardX/proto/event_pb2.py", line 15, in
from tensorboardX.proto import summary_pb2 as tensorboardX_dot_proto_dot_summary__pb2
File "/home/ec2-user/anaconda3/envs/pytorch_p27/lib/python2.7/site-packages/tensorboardX/proto/summary_pb2.py", line 15, in
from tensorboardX.proto import tensor_pb2 as tensorboardX_dot_proto_dot_tensor__pb2
File "/home/ec2-user/anaconda3/envs/pytorch_p27/lib/python2.7/site-packages/tensorboardX/proto/tensor_pb2.py", line 15, in
from tensorboardX.proto import resource_handle_pb2 as tensorboardX_dot_proto_dot_resource__handle__pb2
File "/home/ec2-user/anaconda3/envs/pytorch_p27/lib/python2.7/site-packages/tensorboardX/proto/resource_handle_pb2.py", line 22, in
serialized_pb=_b('\n(tensorboardX/proto/resource_handle.proto\x12\x0ctensorboardX"r\n\x13ResourceHandleProto\x12\x0e\n\x06\x64\x65vice\x18\x01 \x01(\t\x12\x11\n\tcontainer\x18\x02 \x01(\t\x12\x0c\n\x04name\x18\x03 \x01(\t\x12\x11\n\thash_code\x18\x04 \x01(\x04\x12\x17\n\x0fmaybe_type_name\x18\x05 \x01(\tB/\n\x18org.tensorflow.frameworkB\x0eResourceHandleP\x01\xf8\x01\x01\x62\x06proto3')
TypeError: new() got an unexpected keyword argument 'serialized_options'
One RuntimeError occurred when I tried to train SSD on VOC dataset.
You may find more reference from Pytorch Forum:
https://discuss.pytorch.org/t/encounter-the-runtimeerror-one-of-the-variables-needed-for-gradient-computation-has-been-modified-by-an-inplace-operation/836
In my case, I changed the x variable in SSD.py and it worked for me. Hope helps for you!
Line 25 in model/SSD.py
x /= (x.pow(2).sum(dim=1, keepdim=True).sqrt() + 1e-10)
to
x /= (x.clone().pow(2).sum(dim=1, keepdim=True).sqrt() + 1e-10)
You may face same issue when implement other model like SSD512, you can debug by your self with detection feature in pytorch. Change codes in train.py:
Line 268 in train.py
train()
to
with torch.autograd.set_detect_anomaly(True):
train()
for more information:
pytorch/pytorch#15803
When I train the DSOD, I did not load the reducefc.pth, and I replaced the "SSD" with the "DSOD", but something wrong occured."IndexError: invalid index of a 0-dim tensor. Use tensor.item()
in Python or tensor.item<T>()
in C++ to convert a 0-dim tensor to a number
" could you tell me what should I do to solve it?
Is there anyone able to achieve close to paper-reported accuracy using this repo code? Thanks!
help me with to get the pre-trained weights, available for this analysis?
Hey,
I am trying to run this with pytorch 1.0.0 and get the following error
RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation
Any suggestions?
Thanks!
Hi,
Thanks so much for your sharing. I saw you have the RefineDet performance, however, in the models folder I did not see the model file. Could you kindly tell me how to access it?
Thanks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.