-
Notifications
You must be signed in to change notification settings - Fork 532
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Subsetting person class #15
Comments
Hi @Steffgroe , currently there is no easy way to use a subset of VOC datasets. However, you can easily use a subset of the OpenImages dataset. |
@Steffgroe you just need to change the 47 line of .../pytorch-ssd/vision/datasets/voc_dataset.py to |
|
@kurianbenoy For this u actually need to change the trainval.txt and test.txt files which contains the list of all the .xml files. |
Make sure there are no uppercase letters in your voc dataset ,like “PERSON”,“DOG” |
Actually only this is required for creating a subset of PASCALVOOC dataset on using someother dataset like StandfordAction40, merely changing class names and file_paths to the folder in |
i have the same problem ,can you help me@Steffgroe Traceback (most recent call last): |
but, then how should we do? i have tried the above methods. it don't work |
@liuyizhuang , Adding to my previous comment, i have created a script which will create two new files (trainval_new.txt and test_new.txt) from the original (trainval.txt and test.txt) files. You can modify the subset (eg. ['person']) in the script. I have tried it and worked for me. |
thank you , this may not be my problem .because my dataset is made by myself , so not work |
hello ,must my dataset format be same as the VOC dataset? my dataset don't have val.txt ,segmentation,Classification Task and Detection Task. And i put all dataset in a folder. |
As far as i know, this repo supports format like VOC and OpenImages. In case of VOC, the annotations will be in the form of xml, if the annotations are in the csv format, then its like Open_images format. |
thank you ,i have xml ,but "too many indices for array" |
i still want to detect subsetting person, but when I load pre-train weight 'mb2-ssd-lite-mp-0_686.pth'. I get problem |
The error basically means that you are trying to load weights trained for 20+1 classes, and your model has 1+1 classes.
|
@ChetanPatil28 thank you, I fix it by pruning weight. First I load pre-train model weight. Second I get weight from index, such as I want to detect car, so I only get car branch (id= 7 in 21 classes), so I concatenate([weight[0:6], weight[42:48]) in classification_head weight. Is it right for pruning?. And I get another problem relate to priors box. I use origin priors box, because it has 1:1, 2:1, 1:2, 1:3, 3:1(aspect ratio), I think it good for car detection. But when I testing with my weight, it very bad for detection. May be it cause by priors box generate? If it True, Can you help to modify SSDSpecs ? Thanks in advance. `
|
Hi! First of all thank you for this working implementation of SSD in pytorch.
I am trying to build a person detector with this implementation for my bachelor thesis. I removed the other classes in voc_dataset.py, but I run into trouble because your code is loading all the annotations classes by default. What do I need to change to make it train only on person and background for pascal VOC?
When I change the _get_annotation function to only include class_name == 'person' I get the following error:
ndexError: Traceback (most recent call last):
File "/home/steff/.local/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 106, in _worker_loop
samples = collate_fn([dataset[i] for i in batch_indices])
File "/home/steff/.local/lib/python3.6/site-packages/torch/utils/data/dataloader.py", line 106, in
samples = collate_fn([dataset[i] for i in batch_indices])
File "/home/steff/.local/lib/python3.6/site-packages/torch/utils/data/dataset.py", line 81, in getitem
return self.datasets[dataset_idx][sample_idx]
File "/home/steff/bachelor-project/pytorch-ssd-master/vision/datasets/voc_dataset.py", line 37, in getitem
image, boxes, labels = self.transform(image, boxes, labels)
File "/home/steff/bachelor-project/pytorch-ssd-master/vision/ssd/data_preprocessing.py", line 34, in call
return self.augment(img, boxes, labels)
File "/home/steff/bachelor-project/pytorch-ssd-master/vision/transforms/transforms.py", line 55, in call
img, boxes, labels = t(img, boxes, labels)
File "/home/steff/bachelor-project/pytorch-ssd-master/vision/transforms/transforms.py", line 275, in call
overlap = jaccard_numpy(boxes, rect)
File "/home/steff/bachelor-project/pytorch-ssd-master/vision/transforms/transforms.py", line 30, in jaccard_numpy
inter = intersect(box_a, box_b)
File "/home/steff/bachelor-project/pytorch-ssd-master/vision/transforms/transforms.py", line 13, in intersect
max_xy = np.minimum(box_a[:, 2:], box_b[2:])
IndexError: too many indices for array
How can I subset the class person properly?
Thanks in advance!
The text was updated successfully, but these errors were encountered: