Skip to content
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

How to train my own dataset? #3

Open
madenburak opened this issue Feb 16, 2022 · 11 comments
Open

How to train my own dataset? #3

madenburak opened this issue Feb 16, 2022 · 11 comments

Comments

@madenburak
Copy link

Congratulations for this job. It is nice project. I follow your directory for train. It works when I have two keypoints. Assuming I have 10 points but It didn't work when I didn't mark all the keypoints in the images. How i can ?

@alexppppp
Copy link
Owner

I've trained this model with 8 keypoints, and it works very good

It's important to have a large dataset to train the model well

@madenburak
Copy link
Author

The model is work well, if all keypoints are marked. if there is not all keypoint in annotated image, when txt files convert to json some keypoint is null. I start training, it stop.

@alexppppp
Copy link
Owner

There are two ways to solve the problem:
a). either mark all unmarked keypoints
b). or remove images where not all keypoints are marked

@madenburak
Copy link
Author

I annotated all point on images but I getting this error.

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
/tmp/ipykernel_8167/1220785760.py in <module>
     11 
     12 model = get_model(num_keypoints = 5)
---> 13 model.to(device)
     14 
     15 params = [p for p in model.parameters() if p.requires_grad]

~/anaconda3/envs/point/lib/python3.8/site-packages/torch/nn/modules/module.py in to(self, *args, **kwargs)
    897             return t.to(device, dtype if t.is_floating_point() or t.is_complex() else None, non_blocking)
    898 
--> 899         return self._apply(convert)
    900 
    901     def register_backward_hook(

~/anaconda3/envs/point/lib/python3.8/site-packages/torch/nn/modules/module.py in _apply(self, fn)
    568     def _apply(self, fn):
    569         for module in self.children():
--> 570             module._apply(fn)
    571 
    572         def compute_should_use_set_data(tensor, tensor_applied):

~/anaconda3/envs/point/lib/python3.8/site-packages/torch/nn/modules/module.py in _apply(self, fn)
    568     def _apply(self, fn):
    569         for module in self.children():
--> 570             module._apply(fn)
    571 
    572         def compute_should_use_set_data(tensor, tensor_applied):

~/anaconda3/envs/point/lib/python3.8/site-packages/torch/nn/modules/module.py in _apply(self, fn)
    568     def _apply(self, fn):
    569         for module in self.children():
--> 570             module._apply(fn)
    571 
    572         def compute_should_use_set_data(tensor, tensor_applied):

~/anaconda3/envs/point/lib/python3.8/site-packages/torch/nn/modules/module.py in _apply(self, fn)
    591             # `with torch.no_grad():`
    592             with torch.no_grad():
--> 593                 param_applied = fn(param)
    594             should_use_set_data = compute_should_use_set_data(param, param_applied)
    595             if should_use_set_data:

~/anaconda3/envs/point/lib/python3.8/site-packages/torch/nn/modules/module.py in convert(t)
    895                 return t.to(device, dtype if t.is_floating_point() or t.is_complex() else None,
    896                             non_blocking, memory_format=convert_to_format)
--> 897             return t.to(device, dtype if t.is_floating_point() or t.is_complex() else None, non_blocking)
    898 
    899         return self._apply(convert)

RuntimeError: CUDA error: device-side assert triggered
CUDA kernel errors might be asynchronously reported at some other API call,so the stacktrace below might be incorrect.
For debugging consider passing CUDA_LAUNCH_BLOCKING=1.

@alexppppp
Copy link
Owner

Don't know, I didn't get such error

If you share your notebook and dataset, I can check it once I have a free time

@madenburak
Copy link
Author

How can I send my dataset? Mail or drive?

@alexppppp
Copy link
Owner

What is your email?

@sowmyakavali
Copy link

I annotated all point on images but I getting this error.

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
/tmp/ipykernel_8167/1220785760.py in <module>
     11 
     12 model = get_model(num_keypoints = 5)
---> 13 model.to(device)
     14 
     15 params = [p for p in model.parameters() if p.requires_grad]

~/anaconda3/envs/point/lib/python3.8/site-packages/torch/nn/modules/module.py in to(self, *args, **kwargs)
    897             return t.to(device, dtype if t.is_floating_point() or t.is_complex() else None, non_blocking)
    898 
--> 899         return self._apply(convert)
    900 
    901     def register_backward_hook(

~/anaconda3/envs/point/lib/python3.8/site-packages/torch/nn/modules/module.py in _apply(self, fn)
    568     def _apply(self, fn):
    569         for module in self.children():
--> 570             module._apply(fn)
    571 
    572         def compute_should_use_set_data(tensor, tensor_applied):

~/anaconda3/envs/point/lib/python3.8/site-packages/torch/nn/modules/module.py in _apply(self, fn)
    568     def _apply(self, fn):
    569         for module in self.children():
--> 570             module._apply(fn)
    571 
    572         def compute_should_use_set_data(tensor, tensor_applied):

~/anaconda3/envs/point/lib/python3.8/site-packages/torch/nn/modules/module.py in _apply(self, fn)
    568     def _apply(self, fn):
    569         for module in self.children():
--> 570             module._apply(fn)
    571 
    572         def compute_should_use_set_data(tensor, tensor_applied):

~/anaconda3/envs/point/lib/python3.8/site-packages/torch/nn/modules/module.py in _apply(self, fn)
    591             # `with torch.no_grad():`
    592             with torch.no_grad():
--> 593                 param_applied = fn(param)
    594             should_use_set_data = compute_should_use_set_data(param, param_applied)
    595             if should_use_set_data:

~/anaconda3/envs/point/lib/python3.8/site-packages/torch/nn/modules/module.py in convert(t)
    895                 return t.to(device, dtype if t.is_floating_point() or t.is_complex() else None,
    896                             non_blocking, memory_format=convert_to_format)
--> 897             return t.to(device, dtype if t.is_floating_point() or t.is_complex() else None, non_blocking)
    898 
    899         return self._apply(convert)

RuntimeError: CUDA error: device-side assert triggered
CUDA kernel errors might be asynchronously reported at some other API call,so the stacktrace below might be incorrect.
For debugging consider passing CUDA_LAUNCH_BLOCKING=1.

@madenburak
you are getting this error because you don't have enough memory in your system to process the batch of images.

@HanSeulChung
Copy link

@madenburak how did you mark annotations not visible in the image? I set annotations not visible in the image [0,0,0]. because [x,y,visibility] visibility =0 means that the keypoint is not visible.

@HanSeulChung
Copy link

HanSeulChung commented Apr 12, 2023

@alexppppp

[[530, 555, 4400, 2025]]

ValueError Traceback (most recent call last)
in <cell line: 21>()
20
21 for epoch in range(num_epochs):
---> 22 train_one_epoch(model, optimizer, data_loader_train, device, epoch, print_freq=1000)
23 lr_scheduler.step()
24 evaluate(model, data_loader_test, device)

13 frames
/usr/local/lib/python3.9/dist-packages/albumentations/core/keypoints_utils.py in convert_keypoint_to_albumentations(keypoint, source_format, rows, cols, check_validity, angle_in_degrees)
197
198 if source_format == "xy":
--> 199 if len(keypoint[:2])== 0 | len(keypoint[2:])==0:
200 (x, y), tail = [0,0], tuple(0, 0)
201 else:

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

My keypoints are 5. and There are keypoints not visible in the image. so after annotation i change empty list to [0,0,0].
what can i do?.....

@ericfried1204
Copy link

Please see your dataset. If the value in annotation of dataset is empty, the above error is occur. I deleted the files that have empty value and then it is worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants