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
Can noise be added to Dataset. #1357
Comments
Hi, you can add your custom data pipeline which can handle data preprocessing. For more detail, please refer to this tutorial: https://github.com/open-mmlab/mmpose/blob/master/docs/en/tutorials/3_data_pipeline.md#extend-and-use-custom-pipelines |
I mean where we can look into the code of mmpose if there is possibility to add noise to dataset ? |
In this link this is the noise added ? Sorry to ask such questions because I am new to this topic so need help . |
In the config which I am training this snippet is already added . dict(type='TopDownAffine'), |
What does the noise mean here? If you mean the randomness in data preprocessing, you can find some pipelines here: https://github.com/open-mmlab/mmpose/blob/master/mmpose/datasets/pipelines/top_down_transform.py, in which |
These three pipelines: |
According to me augmentating data with noise means we want to avoid over fitting and improve the performance of our model . So according to you what does augmenting data with noise means ? |
Also by looking into code of MMPOSE can we augment data with noise ? |
That depends on your need. I think you can try these pipelines. BTW, which dataset are you using?
|
I have concatenated COCO and THEODORE dataset |
So, is it possible to augment data with random noise ?? |
Yes, you can try to add one or several of these pipelines in your config: |
@YuktiADY You can use albumentations in mmpose, it supports various kinds of augmentation approaches. |
For more information about albumentations, please check https://albumentations.ai/ |
I will check. |
Simply just have to add these class to config , no other changes will be required ? |
The above approach of adding above pipelines will also work right ? |
These are also augmentation approaches, shifting the center, flipping, crop the box, scaling, rotation. |
I just want to first check based on the code in MMPOSE if it is possible to add noise . |
|
These are different approaches for augmentation like center, flipping,crop the box . |
For flipping, you may try |
Okay, I mean this is for flipping . What about adding noise , which one is for augmenting data with random noise ? |
Flipping can be viewed as a method of augmenting data with random noise as it can randomly flip the image. If you want to add pixel-level noise to the data, you can use |
okay Thank you. Understood. |
So just adding this class in config , are any other changes also required ? |
I just saw in the config dict(type='TopDownRandomFlip', flip_prob=0.5), is alreadythere . |
You can try to use this in your config and see if it has better results. train_pipeline = [
dict(type='LoadImageFromFile'),
dict(type='TopDownGetBboxCenterScale', padding=1.25),
dict(type='TopDownRandomShiftBboxCenter', shift_factor=0.16, prob=0.3),
dict(type='TopDownRandomFlip', flip_prob=0.5),
dict(
type='TopDownHalfBodyTransform',
num_joints_half_body=8,
prob_half_body=0.3),
dict(
type='TopDownGetRandomScaleRotation', rot_factor=40, scale_factor=0.5),
dict(type='TopDownAffine'),
###########################
# add the Albumentation here
dict(
type='Albumentation',
transforms=[
dict(
type='CoarseDropout',
max_holes=8,
max_height=40,
max_width=40,
min_holes=1,
min_height=10,
min_width=10,
p=0.5),
]),
###########################
dict(type='ToTensor'),
dict(
type='NormalizeTensor',
mean=[0.485, 0.456, 0.406],
std=[0.229, 0.224, 0.225]),
dict(type='TopDownGenerateTarget', sigma=2),
dict(
type='Collect',
keys=['img', 'target', 'target_weight'],
meta_keys=[
'image_file', 'joints_3d', 'joints_3d_visible', 'center', 'scale',
'rotation', 'bbox_score', 'flip_pairs'
]),
] |
I suggest you read more detail about the implementation of |
Simple Baseline 2D is an algorithm ? Because if i say i am using simple baseline 2D algorithm i am indirectly saying that I am saying that I am using Resnet. |
Yes, you can say like that.
Yes, HRNet and ResNet are two different feature extractors. |
How to test the pre trained models that is trained on coco and evaluate on my test dataset ?? |
I did these changes in config : test_pipeline = val_pipeline data_root = 'data/coco' The script i used for testing is this . But i am getting siye mismatch error, l**oad checkpoint from local path: /home/yukti/Downloads/hrnet_w48_coco_384x288-314c8528_20200708.pth size mismatch for keypoint_head.final_layer.weight: copying a param with shape torch.Size([17, 48, 1, 1]) from checkpoint, the shape in current model is torch.Size([133, 48, 1, 1]). Is this above things I am doing correct ? Awaiting for your response. |
This checkpoint seems like a model trained on |
Please find my changes in config. I gave coco whole body only but i get this base = ['/home/yukti/mmpose/mmpose/configs/base/datasets/theodore.py'] data_root = 'TheodorePlusV2Dataset' I get size mismatch error and AP = 0.0 size mismatch for keypoint_head.final_layer.weight: copying a param with shape torch.Size([133, 48, 1, 1]) from checkpoint, the shape in current model is torch.Size([17, 48, 1, 1]). when i gave checkpoint for coco.It gave results with AP I even tried testing resnet50 model and gave checkpoint for coco dataset only , it ran and gave results but when i run on with coco dataset its gives size mismatch error. I even checked the number of keypoints .. Is there is a problem if we give check point for coco but in config its type is topdowncoco whole body .?? |
Could you please provide the config for your model? Seems like the model you are using will output 17 channels but the checkpoint you are using will output 133 channels.
Please use the model that matches your expected output.
If you would like to test on a dataset like COCO dataset (which has 17 keypoints thus need to output 17 channels), please use checkpoint like this:
|
Please find the config below base = ['/home/yukti/mmpose/mmpose/configs/base/datasets/theodore.py'] optimizer = dict( learning policylr_config = dict( channel_cfg = dict( model settingsmodel = dict( data_cfg = dict( train_pipeline = [ val_pipeline = [ test_pipeline = val_pipeline data_root = 'TheodorePlusV2Dataset' Also I would like to ask if lr = 5e-4 and i reduce it by a factor of 10 so lr = 5e-5 right ? which is best lr out of two ? |
base = ['/home/yukti/mmpose/mmpose/configs/base/datasets/theodore.py'] optimizer = dict( learning policylr_config = dict( channel_cfg = dict( model settingsmodel = dict( data_cfg = dict( train_pipeline = [ val_pipeline = [ test_pipeline = val_pipeline data_root = 'TheodorePlusV2Dataset' Also if lr = 5e-4 and i reduce by factor of 10 , the lr = 5e-05 ? which is best out of these 2 lr ? |
Please change this parameter according to your dataset.
I am afraid that these hyper parameters may need to be tuned on your own dataset. |
Yes earlier it was 133 so i changed to 17. You mean only num_ouput_channels or num_keypoints also ? Is the lr incorrect ? bcoz by default in config lr = 5e-4 |
I mean the number of channels should match the output channels you need in your own dataset. |
yes changed still not working.. Can you check this part, i guess some problem in this. test_pipeline = val_pipeline data_root = 'TheodorePlusV2Dataset' How when giving the checkpoint of coco its working ,? |
How many keypoints does
If it is 133, this is a COCO-Wholebody-style dataset, please set the channels to 133 and use the checkpoint like this:
|
Hello, Where i can find this file python3.x/site-packages/pycocoapi/cocoeval.py ? |
You can try |
Hello, I am trying to evaluate the 13 keypoints so i did few changes in cocoeval.py file with slicing Traceback (most recent call last): |
Seems like the number of keypoints which is 13 in your dataset, did not match the COCO's 17 keypoints. Could you conveniently show the modifications you did? |
I did these changes in cocoeval.py. Actually i am only fetching to evaluate only 13 keypoints from these 17 keypoints,
g = np.array(gt['keypoints'][0:3] + gt['keypoints'][15:]) I checked everywhere but didnt get to resolve this error . Please give your valuable suggestions |
yes i mentioned it 17 only. channel_cfg = dict( |
What did these two lines do? And make sure you did the modifications in |
Actually in our dataset nose keypoint is present in array index 0,1,2 so we are slicing nose[0:3] and rest others [15:]exculding the keypoints of eyes and ears. Because in our dataset we dont have eyes and ears detected , it is based on 13 keypoints. So, we are evaluating only 13 keypoints. But this error i am getting .Please suggest on this . i added here these changes even i tried to print but print also not working elif p.iouType == 'keypoints_righthand':
|
Did you changed this line in According to this line, we are using the sigmas in the datasetinfo. You can see how the sigmas is chosen here. So actually, with your modification, you are using the original COCO sigmas which have 17 numbers, instead of your expected sigmas. You can add sigmas in the datasetinfo like this. |
Yes i have added the sigmas in the cocoeval.py I have changed in datasetinfo too below: But still getting this error . Actually the error is coming in top_down_coco_dataset.py where it is taking config of coco.py and there it is taking 17 sigma values as below: Do i need to change in this coco,py file too the sigma values ? Not sure from where it is giving value error: 17, 13 |
May I see the config you use to instantiate the dataset object? I guess the datasetinfo file used to instantiate the dataset may be mistakenly specified as |
## THEODORE.PY dataset_info = dict( CONFIG FILE (HRNET_W48_384 x 288)base = ['/home/yukti/mmpose/mmpose/configs/base/datasets/theodore.py'] optimizer = dict( learning policylr_config = dict( channel_cfg = dict( model settingsmodel = dict( data_cfg = dict( ) train_pipeline = [ val_pipeline = [ test_pipeline = val_pipeline dataset settingsdataset_type = 'TheodorePlusV2Dataset' data_root = '/mnt/dst_datasets/own_omni_dataset/theodore_plus_v2' |
I think this error may be that the keypoints prediction results' shape is (17,) but the sigmas is (13,) so their sizes did not match Please double-check the shape of your prediction results and the sigmas. Since you have exculded the keypoints of eyes and ears and modified the sigmas=np.array([
0.026, 0.079, 0.079, 0.072, 0.072, 0.062, 0.062,
0.107, 0.107, 0.087, 0.087, 0.089, 0.089
]) and see if the error still exists. |
In order to make each issue focus on one question, I will close this issue for now. |
Hallo Team,
I was training the hrnet model and trying to improve the accuracy of model since trained the model too many times and it may lead to overfitting.
I would like to know if there is a possibility to augment the data with random noise in MMPOSE?
Where to look into the code of mmpose and how we can do this ?
Please suggest !
The text was updated successfully, but these errors were encountered: