Git Product home page Git Product logo

zexinchen / alphatracker Goto Github PK

View Code? Open in Web Editor NEW
58.0 58.0 16.0 41.65 MB

AlphaTracker is a computer vision pipeline with the practical and real-time advantages , which requires minimal hardware requirements and produces reliable tracking of multiple unmarked animals. An easy-to-use user interface further enables manual inspection and curation of results.

Jupyter Notebook 33.81% Python 26.82% Shell 0.15% Lua 0.40% MATLAB 1.13% C++ 0.44% Makefile 0.16% C 20.15% Cuda 1.26% Batchfile 0.01% CSS 0.09% JavaScript 14.23% HTML 1.16% Cython 0.20%
multi-animal-tracking neuroscience

alphatracker's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

alphatracker's Issues

fail to train

Traceback (most recent call last):
File "train.py", line 204, in
main()
File "train.py", line 122, in main
weight_save = torch.load(opt.loadModel)
File "/usr/local/lib/python3.8/site-packages/torch/serialization.py", line 608, in load
return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
File "/usr/local/lib/python3.8/site-packages/torch/serialization.py", line 777, in _legacy_load
magic_number = pickle_module.load(f, **pickle_load_args)
_pickle.UnpicklingError: invalid load key, '<'.

error in one of the train model steps

Screenshot 2023-11-01 175601

I am using the googlecolab version and in my google drive alphatracker folder, the cfg/mice.data exists in the correct location but the error is coming up that it does not exist.

Error in clustering

While running python fft_main_sep_twoMiceInteract.py . I received an error. Kindly, please inform what could be the potential reason for the error. I am using sample data and run the steps given on the Colab notebook.

image

After this step I run the Analysis notebook. I receive a file not found error. I have checked that there is no folder/directory named as results_social on my drive. Please inform what should be the location of the results?

image

Error in Tracking

I have encountered an error in tracking that a file has not found at the location: /gdrive/result_folder/oriFrameFromVideo//sample_video/frame_folder//*.txt. I am using the sample dataset and running the notebook on Colab.

What could be potential reason for the error. how can I resolve it?

Screenshot 2022-09-26 154023

Error in running Colab on my own annotated frames

Hello,

I have tried AlphaTracker on the sample data you have provided. That worked successfully.

For Experimentation, I annotated the frames you have provided using the annotation tool. It generates the multi-person annotation file only. I used that to run the Colab notebook. I am receiving NaNs in the alphapose-results.json.

I have placed my annotated frames along with the multi_person.json file in the Sample_Data folder.
image

Please guide me How I can use my own annotated data to run on Colab. I don't have GPU and Linux.

failed to create symbolic link and import cv2

When using the google colab version I get the following error at Step 8

ln: failed to create symbolic link '/gdrive/My Drive': Input/output error
/content/drive/My Drive/AlphaTracker/Tracking/AlphaTracker
Traceback (most recent call last):
File "trainCOLAB.py", line 7, in
import cv2
ModuleNotFoundError: No module named 'cv2'

I've checked to ensure that the folder was correctly added to My Drive

Error in tracking/pose estimation

Hi, first of all thank you for all the amazing work you've done. I'm trying to use AlphaTracker via google colab and in step 9 I came across this error:
`Traceback (most recent call last):
Immagine 20

Could you help me out? thank you so much

YOLO weigths error for demo tracking

Hi, I have a question about running demo with pretrained model.
When I run 'python track.py' without changing anything, those error message came out.
Isn't this mean the pretrained weight not matched with YOLO model ?

Traceback (most recent call last):
  File "demo.py", line 46, in <module>
    det_loader = DetectionLoader(data_loader, batchSize=args.detbatch,use_boxGT=args.use_boxGT,gt_json=args.gt_json).start()
  File "/home/mona0414/GITHUB/Choi-lab/AlphaTracker/Tracking/AlphaTracker/dataloader.py", line 338, in __init__
    self.det_model.load_weights(opt.yolo_model_path)
  File "/home/mona0414/GITHUB/Choi-lab/AlphaTracker/Tracking/AlphaTracker/yolo/darknet.py", line 488, in load_weights
    conv_weights = conv_weights.view_as(conv.weight.data)
RuntimeError: shape '[32, 3, 3, 3]' is invalid for input of size 420
terminate called without an active exception
Aborted (core dumped)

Cannot use UI

Dear,
Thank you for your great job. I am now finishing track.py and got a json file of result. However when I run server.py to visualize the result, it turns out to be ""GET /data/scipy.data HTTP/1.1" 404 -". And the google-chrome ui just tells me to "Please Wait" without any changing.

X and y axis labels?

Can someone inform me what are the x axis(-200 to 200) and y axis ranges( -300 to 300) are representing in the following graphs?

image

Error in Colab training

I'm using your annotated data and training, not changing anything in the lines since I wanted to just check the steps but i'm not getting any results at all using your sample data. I'll get a results folder in my drive but nothing in it and I haven't changed any of the code so I'm uncertain as to why this error under step nine is occurring.

Frame will be saved in /gdrive/result_folder/oriFrameFromVideo//sample_video/frame_folder/
extracting frames from video...
processing /gdrive/sample_video.mp4
read failed!make sure that the video format is supported by cv2.VideoCapture
0% 0/300 [00:00<?, ?it/s]read frame failed!
0% 0/300 [00:00<?, ?it/s]
getting demo image:
CUDA_VISIBLE_DEVICES='0' python3 demo.py
--nClasses 4
--indir /gdrive/result_folder/oriFrameFromVideo//sample_video/frame_folder/
--outdir /gdrive/result_folder
--yolo_model_path /gdrive/AlphaTracker/Tracking/AlphaTracker/train_yolo/darknet//backup/Trial/yolov3-mice_final.weights
--yolo_model_cfg /gdrive/AlphaTracker/Tracking/AlphaTracker/train_yolo/darknet//cfg/yolov3-mice.cfg
--pose_model_path /gdrive/AlphaTracker/Tracking/AlphaTracker/train_sppe/exp/coco/Trial/model_10.pkl
--use_boxGT 0
Loading YOLO model..
not using ground truth box to do the eval.
Traceback (most recent call last):
File "demo.py", line 60, in
det_loader = DetectionLoader(data_loader, batchSize=args.detbatch,use_boxGT=args.use_boxGT,gt_json=args.gt_json).start()
File "/content/drive/My Drive/AlphaTracker/Tracking/AlphaTracker/dataloader.py", line 338, in init
self.det_model.load_weights(opt.yolo_model_path)
File "/content/drive/My Drive/AlphaTracker/Tracking/AlphaTracker/yolo/darknet.py", line 407, in load_weights
fp = open(weightfile, "rb")
FileNotFoundError: [Errno 2] No such file or directory: '/gdrive/AlphaTracker/Tracking/AlphaTracker/train_yolo/darknet//backup/Trial/yolov3-mice_final.weights'

tracking pose:
python ./PoseFlow/tracker-general-fixNum-newSelect-noOrb.py
--imgdir /gdrive/result_folder/oriFrameFromVideo//sample_video/frame_folder/
--in_json /gdrive/result_folder/alphapose-results.json
--out_json /gdrive/result_folder/alphapose-results-forvis-tracked.json
--visdir /gdrive/result_folder/pose_track_vis/ --vis 1
--image_format %s.png --max_pid_id_setting 2 --match 0 --weights 0 6 0 0 0 0
--out_video_path /gdrive/result_folder/Trial_2_0_060000.mp4
Traceback (most recent call last):
File "./PoseFlow/tracker-general-fixNum-newSelect-noOrb.py", line 215, in
with open(notrack_json) as f:
FileNotFoundError: [Errno 2] No such file or directory: '/gdrive/result_folder/alphapose-results.json'

Error in training: cannot load `AlphaTracker/Tracking/AlphaTracker/models/sppe/duc_se.pth`

I obtain the following error when running train.py. Some googling suggests this results from a corrupt file download. When I run md5sum on duc_se.pth, I get 3764b858a2f612f536c841c971ea8e63 (and the file appears to be 34K). Is that correct? If not, can you provide an alternative way to download it?

*** training sppe ***
training with following setting:
CUDA_VISIBLE_DEVICES=0 python train.py \
             --dataset coco \
             --img_folder_train /n/groups/datta/caleb/22_2_1_keypointSORT/log/22_8_5_alphaTracker/AlphaTracker/Tracking/AlphaTracker/train_yolo/darknet//data/top/color/ \
             --annot_file_train /n/groups/datta/caleb/22_2_1_keypointSORT/log/22_8_5_alphaTracker/AlphaTracker/Tracking/AlphaTracker/train_sppe//data/top/data_newLabeled_01_train.h5 \
             --img_folder_val /n/groups/datta/caleb/22_2_1_keypointSORT/log/22_8_5_alphaTracker/AlphaTracker/Tracking/AlphaTracker/train_yolo/darknet//data/top/color/ \
             --annot_file_val /n/groups/datta/caleb/22_2_1_keypointSORT/log/22_8_5_alphaTracker/AlphaTracker/Tracking/AlphaTracker/train_sppe//data/top/data_newLabeled_01_val.h5 \
             --expID top \
             --nClasses 7 \
             --LR 0.0001 --trainBatch 10 \
             --nEpochs 10 \
             --nThreads 6 \
             --loadModel /n/groups/datta/caleb/22_2_1_keypointSORT/log/22_8_5_alphaTracker/AlphaTracker/Tracking/AlphaTracker/models/sppe/duc_se.pth
Loading Model from /n/groups/datta/caleb/22_2_1_keypointSORT/log/22_8_5_alphaTracker/AlphaTracker/Tracking/AlphaTracker/models/sppe/duc_se.pth
Traceback (most recent call last):
  File "train.py", line 204, in <module>
    main()
  File "train.py", line 122, in main
    weight_save = torch.load(opt.loadModel)
  File "/home/csw14/miniconda3/envs/alphatracker/lib/python3.8/site-packages/torch/serialization.py", line 608, in load
    return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
  File "/home/csw14/miniconda3/envs/alphatracker/lib/python3.8/site-packages/torch/serialization.py", line 777, in _legacy_load
    magic_number = pickle_module.load(f, **pickle_load_args)
_pickle.UnpicklingError: invalid load key, '<'.

get NaN after step9Tracking / pose estimation in colab

/content/drive/My Drive/AlphaTracker/Tracking/AlphaTracker
Frame will be saved in /gdrive/result_folder/oriFrameFromVideo//trainvideo1/frame_folder/
extracting frames from video...
processing /gdrive/Sample_Data/trainvideo1.mp4
100% 1814/1814 [03:35<00:00, 8.41it/s]
getting demo image:
CUDA_VISIBLE_DEVICES='0' python3 demo.py
--nClasses 4
--indir /gdrive/result_folder/oriFrameFromVideo//trainvideo1/frame_folder/
--outdir /gdrive/result_folder
--yolo_model_path /gdrive/AlphaTracker/Tracking/AlphaTracker/train_yolo/darknet//backup/demo/yolov3-mice_final.weights
--yolo_model_cfg /gdrive/AlphaTracker/Tracking/AlphaTracker/train_yolo/darknet//cfg/yolov3-mice.cfg
--pose_model_path /gdrive/AlphaTracker/Tracking/AlphaTracker/train_sppe/exp/coco/demo/model_10.pkl
--use_boxGT 0
Loading YOLO model..
not using ground truth box to do the eval.
Loading pose model from /gdrive/AlphaTracker/Tracking/AlphaTracker/train_sppe/exp/coco/demo/model_10.pkl
0% 0/1814 [00:00<?, ?it/s]/usr/local/lib/python3.8/site-packages/torch/nn/functional.py:718: UserWarning: Named tensors and all their associated APIs are an experimental feature and subject to change. Please do not use them for anything important until they are released as stable. (Triggered internally at /opt/conda/conda-bld/pytorch_1623448278899/work/c10/core/TensorImpl.h:1156.)
return torch.max_pool2d(input, kernel_size, stride, padding, dilation, ceil_mode)
100% 1814/1814 [02:14<00:00, 13.45it/s]
===========================> Finish Model Running.

Tracking pose:
python ./PoseFlow/tracker-general-fixNum-newSelect-noOrb.py
--imgdir /gdrive/result_folder/oriFrameFromVideo//trainvideo1/frame_folder/
--in_json /gdrive/result_folder/alphapose-results.json
--out_json /gdrive/result_folder/alphapose-results-forvis-tracked.json
--visdir /gdrive/result_folder/pose_track_vis/ --vis 1
--image_format %s.png --max_pid_id_setting 2 --match 0 --weights 0 6 0 0 0 0
--out_video_path /gdrive/result_folder/demo_2_0_060000.mp4

Start loading json file...
remove extract persons...
100% 26/26 [00:00<00:00, 773417.76it/s]
0% 0/26 [00:00<?, ?it/s]
Traceback (most recent call last):
File "./PoseFlow/tracker-general-fixNum-newSelect-noOrb.py", line 247, in
track[img_name][bid+1]['box_pos'] = [ int(notrack[img_name][bid]['box'][0]),
ValueError: cannot convert float NaN to integer

Errors in training AlphaTracker

First of all, thanks for developing AlphaTracker! It is really a useful tool in animal behavior study. Unfortunately, I encountered with some errors. Could you please help me with these errors?
I used AlphaTracker via Google Colab. And there were errors in Step 8.
image
And I also got warnings in Step7.
image
image

Unable to install

Hello! I'm fairly new to the coding world and am having trouble installing the tools for the alpha tracker unfortunately and would like some help.

After dowloading the repository and changing the directory, I input the code "conda new env -f environment.yaml" I got this as a result:

Collecting package metadata (repodata.json): done
Solving environment: failed

ResolvePackageNotFound:

  • glib==2.56.2=hd408876_0
  • freetype==2.9.1=h8a8886c_1
  • libstdcxx-ng==8.2.0=hdf63c60_1
  • libxslt==1.1.33=h7d1a2b0_0
  • libpng==1.6.37=hbc83047_0
  • expat==2.2.6=he6710b0_0
  • openssl==1.0.2t=h7b6447c_1
  • fontconfig==2.13.0=h9420a91_0
  • sip==4.19.8=py36hf484d3e_0
  • libuuid==1.0.3=h1bed415_2
  • pyqt==5.9.2=py36h05f1152_2
  • dbus==1.13.6=h746ee38_0
  • lxml==4.4.1=py36hefd8a0e_0
  • sqlite==3.23.1=he433501_0
  • pywavelets==1.0.3=py36hdd07704_1
  • jpeg==9b=h024ee3a_2
  • zeromq==4.3.1=he6710b0_3
  • tk==8.6.8=hbc83047_0
  • pyrsistent==0.14.11=py36h7b6447c_0
  • gst-plugins-base==1.14.0=hbbd80ab_1
  • gmp==6.1.2=h6c8ec71_1
  • qt==5.9.6=h52aff34_0
  • libxml2==2.9.9=he19cac6_0
  • tornado==6.0.2=py36h7b6447c_0
  • python==3.6.2=hca45abc_19
  • ncurses==6.0=h9df7e31_2
  • libedit==3.1=heed3624_0
  • readline==7.0=ha6073c6_4
  • intel-openmp==2019.4=243
  • ptyprocess==0.6.0=py36_0
  • libgcc-ng==8.2.0=hdf63c60_1
  • xz==5.2.4=h14c3975_4
  • libsodium==1.0.16=h1bed415_0
  • libtiff==4.0.10=h2733197_2
  • pyzmq==18.0.0=py36he6710b0_0
  • gstreamer==1.14.0=hb453b48_1
  • libxcb==1.13=h1bed415_1
  • zstd==1.3.7=h0b5b093_0
  • libgfortran-ng==7.3.0=hdf63c60_0
  • statsmodels==0.10.1=py36hdd07704_0
  • traitlets==4.3.2=py36h674d592_0
  • pcre==8.43=he6710b0_0
  • cytoolz==0.10.1=py36h7b6447c_0
  • scikit-image==0.15.0=py36he6710b0_0
  • libffi==3.2.1=hd88cf55_4
  • zlib==1.2.11=h7b6447c_3
  • markupsafe==1.1.1=py36h7b6447c_0
  • mistune==0.8.4=py36h7b6447c_0
  • scikit-learn==0.20.1=py36h4989274_0
  • icu==58.2=h9c2bf20_1

When doing the follow up command of "conda activate alphatracker" what I get is:
Could not find conda environment: alphatracker
You can list all discoverable environments with conda info --envs.

not certain what to do here. I did conda update conda and was able to download pytorch successfully so I'm a bit at a loss. Any help would be great!

Missing features

I followed the steps in the behavioral clustering manual and changed the settings in settings.py for social behavior, but when I run the clustering script it says some of the features do not exist:
Feature left_ear does not exists! All feature: ['body_change_ang', 'newFeatureName', 'displace_x', 'displace_y', 'displace_rho', 'displace_phi_c', 'displace_phi_s', 'body_length', 'head_length', 'head_body_angles', 'nose_fft_amp', 'nose_fft_ang', 'contourPCA_fft_amp', 'contourPCA_fft_ang', 'displace_x_TO', 'displace_y_TO', 'displace_rho_TO', 'displace_phi_c_TO', 'displace_phi_s_TO', 'body_length_TO', 'head_length_TO', 'head_body_angles_TO', 'nose_fft_amp_TO', 'nose_fft_ang_TO', 'contourPCA_fft_amp_TO', 'contourPCA_fft_ang_TO', 'two_body_ang', 'two_head_ang', 'TM_nose_RM_tail_displace_phi', 'TM_nose_RM_tail_displace_rho', 'RM_nose_TM_tail_displace_phi', 'RM_nose_TM_tail_displace_rho', 'nose_nose_displace_rho', 'nose_nose_displace_phi', 'TM_nose_RM_tail_distance', 'RM_nose_TM_tail_distance', 'nose_nose_distance']
Is there an updated version of fft_utils.py with all of the features listed in the behavioral clustering manual?
Thanks!

Install conda environment

Hi:

I have problem with the 'Install Conda environment'. May I have you generous help? Please see the attach for my command and the running results .
Screenshot 2020-12-14 at 16 49 20

About curating the video label/points manually

Hi,
Thanks for your great work firstly.
However, I have a problem with curating process. I evaluated the UI/server.py and it connected to localhost successfully. Using the provided GUI I try to load the json and video, but the page just keeps me waiting and collapses out of expectation or load a incomplete label of 2 mice(I had three mice in the video while it only two labeled, but it was working well in the visualization video).

Error in running train.py on GPU machine

I am facing issue while running the train.py on GPU linux machine.
train.sh: line 1: ./darknet directory is not found.

Please, inform how can I resolve the error?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.