akshaykadam771 / Suspicious-Activity-Detection-Using-Pose-Estimation

24 stars 10 forks source link

Custom Dataset #1

Closed nomaad42 closed 2 years ago

nomaad42 commented 3 years ago

Thanks a lot for your great work! Can you please share step by step how did you create a custom dataset?

akshaykadam771 commented 3 years ago

Hi @aidynabirov ,

1) Suppose you want to detect 2 activities. 1) Running 2) standing 2) So first collect some images of Running and Standing. 3) Suppose you have collected 100-100 images for both. 4) Now rename these images with their activities eg. Running_0.jpg , Running_1.jpg, ....up to 100, and similarly for do for Standing images as well. 5) Now just run the AlphaPose model on those all 200 images. 6) Now you will get a JSON file for all of these images which contain the activity key points of all images one by one in a row along with their name( 'id' column of JSON file represent the image name). 7) So now you have a numerical dataset of all activities so you can train any Classification Machine Learning model on this data and then just add your trained ML model with AlphaPose. (i.e Keypoints will be your 'Inputs' and Image ID which represents the image name will be your 'Output' activity. ) 8) Finally, you have to combine both Alphapose and your Trained ML model for activity recognition. 9 ) So your final Activity Recognition Model will be a combination of 'AlphaPose' which gives you the 17 key points of the body and Your trained model which detects those activities.

nomaad42 commented 3 years ago

@akshaykadam771 , Thanks a lot for your reply! For the 5th point, which script do you run for images? ./alphapose/datasets/custom.py? Or some other script?

akshaykadam771 commented 3 years ago

Run demo_inference.py file

nomaad42 commented 3 years ago

@akshaykadam771, Thanks a lot for the response!

nomaad42 commented 2 years ago

Run demo_inference.py file

Thanks a lot for the response last time! I'm sorry, I am reopenning this issue, but can I ask about this 5th part?

When I run ! python scripts/demo_inference.py --cfg configs/coco/resnet/256x192_res50_lr1e-3_1x.yaml --checkpoint pretrained_models/fast_res50_256x192.pth --indir examples/demo/human_activity_data/ --outdir examples/res --save_img --vis_fast I get the updated 'alphapose-result.json', and then I change the 'id classes' with your 'json_data_preprocessing_colab/json_data_processing_for_Home_Security.ipynb' jupyter notebook file ? Am i right?

Because, when I run the above command, I already need to have 'alphapose-results'. If I specify new folder, it says 'I don't have alphapose-results.json' file.

akshaykadam771 commented 2 years ago

@aidynabirov yes you are right, before running demo_inference.py file you must needed one json file in examplea/res folder otherwise it will give you an error, because I wrote a code according to that.once you run the script, it will automatically update that json file with your latest results.

nomaad42 commented 2 years ago

@akshaykadam771 Thanks a lot! It is really helpful