Open sahinemreaslan opened 1 year ago
hi, you need add directory to find this file "NeighborTrack/neighbortrack.py"
which are from https://github.com/franktpmvu/NeighborTrack/blob/89aa0781c5b59ac570e3c1c47cca5b1dd6a5f945/neighbortrack.py#L23
thanks,
Can I do it using sys.path.append("target path")
i think it's ok.
even after updating sys.path.append("target path") in tracker.py I'm still getting from NeighborTrack.neighbortrack import neighbortrack ModuleNotFoundError: No module named 'NeighborTrack'
can you put your code here?
or copy neighbortrack.py and dir: NTutils to your path and change
from NeighborTrack.neighbortrack import neighbortrack
to
import neighbortrack
Hi, Thanks for the great repo.
I was able to solve the above error: Go to trackers/ostrack/lib/evaluation/tracker.py
Then run: python tracking/create_default_local_file.py --workspace_dir . --data_dir ./data --save_dir ./output and edit trackers/ostrack/lib/evaluation/local.py accordingly.
If you have any other issues let me know. Also, I can post my environment if needed.
i update my readme,
if you see any path error, please add 3 paths on tracking/test.py
{}\NeighborTrack\trackers\ostrack\lib\test\tracker
{}\NeighborTrack\trackers\ostrack\tracking
{} (= NeighborTrack\..\)
if still have problem, please let me know.
YH.
I add the paths to test.py
`import os import sys import argparse
prj_path = os.path.join(os.path.dirname(file), '..') if prj_path not in sys.path: sys.path.append(prj_path)
sys.path.append("/home/ubuntu/NeighborTrack/trackers/ostrack/lib/test/tracker") sys.path.append("/home/ubuntu/NeighborTrack/trackers/ostrack/tracking") sys.path.append("/home/ubuntu/ (= NeighborTrack..))")
from lib.test.evaluation import get_dataset from lib.test.evaluation.running import run_dataset from lib.test.evaluation.tracker import Tracker,NeighborTracker
def run_tracker(tracker_name, tracker_param, run_id=None, dataset_name='otb', sequence=None, debug=0, threads=0, num_gpus=8): """Run tracker on sequence or dataset. args: tracker_name: Name of tracking method. tracker_param: Name of parameter file. run_id: The run id. dataset_name: Name of dataset (otb, nfs, uav, tpl, vot, tn, gott, gotv, lasot). sequence: Sequence number or name. debug: Debug level. threads: Number of threads. """
dataset = get_dataset(dataset_name)
if sequence is not None:
dataset = [dataset[sequence]]
trackers = [Tracker(tracker_name, tracker_param, dataset_name, run_id)]
run_dataset(dataset, trackers, debug, threads, num_gpus=num_gpus)
def run_tracker_neighbor(tracker_name, tracker_param, run_id=None, dataset_name='otb', sequence=None, debug=0, threads=0, num_gpus=8): """Run tracker on sequence or dataset. args: tracker_name: Name of tracking method. tracker_param: Name of parameter file. run_id: The run id. dataset_name: Name of dataset (otb, nfs, uav, tpl, vot, tn, gott, gotv, lasot).`
still get this error:
python3 tracking/video_demo_neighbor.py ostrack vitb_384_mae_ce_32x4_ep300_neighbor /Videos/Pickups_Circle+Tower.avi --optional_box 344 226 37 27 --save_results --debug 0 --save_img Traceback (most recent call last): File "/home/ubuntu/NeighborTrack/trackers/ostrack/tracking/video_demo_neighbor.py", line 12, in <module> from lib.test.evaluation import Tracker,NeighborTracker File "/home/ubuntu/NeighborTrack/trackers/ostrack/tracking/../lib/test/evaluation/__init__.py", line 1, in <module> from .data import Sequence File "/home/ubuntu/NeighborTrack/trackers/ostrack/tracking/../lib/test/evaluation/data.py", line 3, in <module> from lib.train.data.image_loader import imread_indexed File "/home/ubuntu/NeighborTrack/trackers/ostrack/tracking/../lib/train/data/__init__.py", line 1, in <module> from .loader import LTRLoader File "/home/ubuntu/NeighborTrack/trackers/ostrack/tracking/../lib/train/data/loader.py", line 5, in <module> from torch._six import string_classes ModuleNotFoundError: No module named 'torch._six'
sys.path.append("/home/ubuntu/ (= NeighborTrack..))")
means sys.path.append("/home/ubuntu/")
i found this webpage, it say if you are used torch2.0+, it's dosn't have torch._six
I not know read Chinese unfortunately so what you suggest to get low version of torch? Still I add the path and correct thank you for your answer put still I get same Error I not accpect get only error on import six?
oh sorry, he say a 3 way to fix this problem:
1.use the old version of torch
for example, my torch version is torch==1.5.0
from torch._six import * change to
int_classes = int string_classes = str
and if isinstance(root, torch._six.string_classes): change to
if isinstance(root, str):
3.update your torch vision to torchvision==0.15.1
because i never use torch 2.0, so i am not very sure what is this proplem, i think change old version of torch or change torchvision is the simple route. but if you cannot change that, i think you can try the second way.
Again I get low version in torch and now I not get torch six error only:
python3 tracking/video_demo_neighbor.py ostrack vitb_384_mae_ce_32x4_ep300_neighbor /Videos/Pickups_Circle+Tower.avi --optional_box 344 226 37 27 --save_results --debug 1 --save_img plz change /data/ to your base path Traceback (most recent call last): File "/home/ubuntu/NeighborTrack/trackers/ostrack/tracking/video_demo_neighbor.py", line 12, in <module> from lib.test.evaluation import Tracker,NeighborTracker File "/home/ubuntu/NeighborTrack/trackers/ostrack/tracking/../lib/test/evaluation/__init__.py", line 2, in <module> from .tracker import Tracker, trackerlist, NeighborTracker File "/home/ubuntu/NeighborTrack/trackers/ostrack/tracking/../lib/test/evaluation/tracker.py", line 16, in <module> from NeighborTrack.neighbortrack import neighbortrack ModuleNotFoundError: No module named 'NeighborTrack'
although I put in test.py the paths
`import os import sys import argparse
prj_path = os.path.join(os.path.dirname(file), '..') if prj_path not in sys.path: sys.path.append(prj_path)
sys.path.append("/home/ubuntu/NeighborTrack/trackers/ostrack/lib/test/tracker") sys.path.append("/home/ubuntu/NeighborTrack/trackers/ostrack/tracking") sys.path.append("/home/ubuntu/")`
after I add this paths to video_demo_neighboor I get new error :
plz change /data/ to your base path Traceback (most recent call last): File "/home/ubuntu/NeighborTrack/trackers/ostrack/tracking/video_demo_neighbor.py", line 49, in <module> main() File "/home/ubuntu/NeighborTrack/trackers/ostrack/tracking/video_demo_neighbor.py", line 45, in main run_video(args.tracker_name, args.tracker_param, args.videofile, args.optional_box, args.debug, args.save_results, args.save_img) File "/home/ubuntu/NeighborTrack/trackers/ostrack/tracking/video_demo_neighbor.py", line 28, in run_video tracker.run_video_neighbor(videofilepath=videofile, optional_box=optional_box, debug=debug, save_results=save_results,save_img=save_img ,revtracker=invTracker) TypeError: run_video_neighbor() got an unexpected keyword argument 'revtracker'
please change all "invtracker" to "revtracker" in def runvideo neighbor(): I will update that code soon
thank you I think there is some progress now I get plz change /data/ to your base path Traceback (most recent call last): File "/home/ubuntu/NeighborTrack/trackers/ostrack/tracking/video_demo_neighbor.py", line 49, in <module> main() File "/home/ubuntu/NeighborTrack/trackers/ostrack/tracking/video_demo_neighbor.py", line 45, in main run_video(args.tracker_name, args.tracker_param, args.videofile, args.optional_box, args.debug, args.save_results, args.save_img) File "/home/ubuntu/NeighborTrack/trackers/ostrack/tracking/video_demo_neighbor.py", line 28, in run_video tracker.run_video_neighbor(videofilepath=videofile, optional_box=optional_box, debug=debug, save_results=save_results,save_img=save_img ,revtracker=revTracker) File "/home/ubuntu/NeighborTrack/trackers/ostrack/tracking/../lib/test/evaluation/tracker.py", line 435, in run_video_neighbor params = self.get_parameters() File "/home/ubuntu/NeighborTrack/trackers/ostrack/tracking/../lib/test/evaluation/tracker.py", line 318, in get_parameters params = param_module.parameters(self.parameter_name) File "/home/ubuntu/NeighborTrack/trackers/ostrack/tracking/../lib/test/parameter/ostrack.py", line 13, in parameters update_config_from_file(yaml_file) File "/home/ubuntu/NeighborTrack/trackers/ostrack/tracking/../lib/config/ostrack/config.py", line 139, in update_config_from_file with open(filename) as f: FileNotFoundError: [Errno 2] No such file or directory: '/data/NeighborTrack/trackers/ostrack/experiments/ostrack/vitb_384_mae_ce_32x4_ep300_neighbor.yaml'
That file is in this web path, but you need download and change to your file path
trackers/ostrack/experiments/ostrack/vitb_384_mae_ce_32x4_ep300_neighbor.yaml
~/NeighborTrack/trackers/ostrack/experiments/ostrack$ ls vitb_256_mae_32x4_ep300.yaml vitb_384_mae_32x4_ep300.yaml vitb_384_mae_ce_32x4_got10k_ep100.yaml vitb_256_mae_ce_32x4_ep300.yaml vitb_384_mae_ce_32x4_ep300.yaml vitb_384_mae_ce_32x4_got10k_ep100_neighbor.yaml vitb_256_mae_ce_32x4_got10k_ep100.yaml vitb_384_mae_ce_32x4_ep300_neighbor.yaml
I do this
to your base path, i think it is in the /home/ubuntu/
First thank you for your passion and that you help my, it's work now!
I try run on long video I get this error in frame 900
Traceback (most recent call last): File "/home/ubuntu/NeighborTrack/trackers/ostrack/tracking/video_demo_neighbor.py", line 49, in <module> main() File "/home/ubuntu/NeighborTrack/trackers/ostrack/tracking/video_demo_neighbor.py", line 45, in main run_video(args.tracker_name, args.tracker_param, args.videofile, args.optional_box, args.debug, args.save_results, args.save_img) File "/home/ubuntu/NeighborTrack/trackers/ostrack/tracking/video_demo_neighbor.py", line 28, in run_video tracker.run_video_neighbor(videofilepath=videofile, optional_box=optional_box, debug=debug, save_results=save_results,save_img=save_img ,revtracker=revTracker) File "/home/ubuntu/NeighborTrack/trackers/ostrack/tracking/../lib/test/evaluation/tracker.py", line 516, in run_video_neighbor state_neighbor = ntracker._neighbor_track(frame) File "/home/ubuntu/NeighborTrack/neighbortrack.py", line 596, in _neighbor_track costmatrix[0,]=all_rev_iou ValueError: setting an array element with a sequence. The requested array would exceed the maximum number of dimension of 1.
In addition there is option with your code to save video output not single images?
The first question, i have no idea what happend, maybe you can trace the index of all rev iou why costmatrix index less than all rev iou, i need to reproduce this bug
You can use this func to concate images to video or use videowriter to save output to video, i think i am not implement save video func in demo
I run different video and get:
python3 tracking/video_demo_neighbor.py ostrack vitb_384_mae_ce_32x4_ep300_neighbor /home/ubuntu/NeighborTrack/trackers/ostrack/tracking/Videos/AVT_Dive+Cross_Tower+Blur_1.avi --optional_box 357 238 16 14 --save_results --debug 0 --save_img plz change /data/ to your base path test config: {'MODEL': {'PRETRAIN_FILE': 'mae_pretrain_vit_base.pth', 'EXTRA_MERGER': False, 'RETURN_INTER': False, 'RETURN_STAGES': [2, 5, 8, 11], 'BACKBONE': {'TYPE': 'vit_base_patch16_224_ce', 'STRIDE': 16, 'MID_PE': False, 'SEP_SEG': False, 'CAT_MODE': 'direct', 'MERGE_LAYER': 0, 'ADD_CLS_TOKEN': False, 'CLS_TOKEN_USE_MODE': 'ignore', 'CE_LOC': [3, 6, 9], 'CE_KEEP_RATIO': [0.7, 0.7, 0.7], 'CE_TEMPLATE_RANGE': 'CTR_POINT'}, 'HEAD': {'TYPE': 'CENTER_NEIGHBOR', 'NUM_CHANNELS': 256}}, 'TRAIN': {'LR': 0.0004, 'WEIGHT_DECAY': 0.0001, 'EPOCH': 300, 'LR_DROP_EPOCH': 240, 'BATCH_SIZE': 32, 'NUM_WORKER': 10, 'OPTIMIZER': 'ADAMW', 'BACKBONE_MULTIPLIER': 0.1, 'GIOU_WEIGHT': 2.0, 'L1_WEIGHT': 5.0, 'FREEZE_LAYERS': [0], 'PRINT_INTERVAL': 50, 'VAL_EPOCH_INTERVAL': 20, 'GRAD_CLIP_NORM': 0.1, 'AMP': False, 'CE_START_EPOCH': 20, 'CE_WARM_EPOCH': 80, 'DROP_PATH_RATE': 0.1, 'SCHEDULER': {'TYPE': 'step', 'DECAY_RATE': 0.1}}, 'DATA': {'SAMPLER_MODE': 'causal', 'MEAN': [0.485, 0.456, 0.406], 'STD': [0.229, 0.224, 0.225], 'MAX_SAMPLE_INTERVAL': 200, 'TRAIN': {'DATASETS_NAME': ['LASOT', 'GOT10K_vottrain', 'COCO17', 'TRACKINGNET'], 'DATASETS_RATIO': [1, 1, 1, 1], 'SAMPLE_PER_EPOCH': 60000}, 'VAL': {'DATASETS_NAME': ['GOT10K_votval'], 'DATASETS_RATIO': [1], 'SAMPLE_PER_EPOCH': 10000}, 'SEARCH': {'SIZE': 384, 'FACTOR': 5.0, 'CENTER_JITTER': 4.5, 'SCALE_JITTER': 0.5, 'NUMBER': 1}, 'TEMPLATE': {'NUMBER': 1, 'SIZE': 192, 'FACTOR': 2.0, 'CENTER_JITTER': 0, 'SCALE_JITTER': 0}}, 'TEST': {'TEMPLATE_FACTOR': 2.0, 'TEMPLATE_SIZE': 192, 'SEARCH_FACTOR': 5.0, 'SEARCH_SIZE': 384, 'EPOCH': 300}} /home/ubuntu/anaconda3/envs/VitTracker/lib/python3.9/site-packages/torch/_tensor.py:575: UserWarning: floor_divide is deprecated, and will be removed in a future version of pytorch. It currently rounds toward 0 (like the 'trunc' function NOT 'floor'). This results in incorrect rounding for negative values. To keep the current behavior, use torch.div(a, b, rounding_mode='trunc'), or for actual floor division, use torch.div(a, b, rounding_mode='floor'). (Triggered internally at /opt/conda/conda-bld/pytorch_1631630797748/work/aten/src/ATen/native/BinaryOps.cpp:467.) return torch.floor_divide(self, other) 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 Traceback (most recent call last): File "/home/ubuntu/NeighborTrack/trackers/ostrack/tracking/video_demo_neighbor.py", line 49, in <module> main() File "/home/ubuntu/NeighborTrack/trackers/ostrack/tracking/video_demo_neighbor.py", line 45, in main run_video(args.tracker_name, args.tracker_param, args.videofile, args.optional_box, args.debug, args.save_results, args.save_img) File "/home/ubuntu/NeighborTrack/trackers/ostrack/tracking/video_demo_neighbor.py", line 28, in run_video tracker.run_video_neighbor(videofilepath=videofile, optional_box=optional_box, debug=debug, save_results=save_results,save_img=save_img ,revtracker=revTracker) File "/home/ubuntu/NeighborTrack/trackers/ostrack/tracking/../lib/test/evaluation/tracker.py", line 516, in run_video_neighbor state_neighbor = ntracker._neighbor_track(frame) File "/home/ubuntu/NeighborTrack/neighbortrack.py", line 596, in _neighbor_track costmatrix[0,]=all_rev_iou ValueError: setting an array element with a sequence. The requested array would exceed the maximum number of dimension of 1.
same error maybe it's bug?
did you can give me your video? because i cannot get that bug at my computer, or you can see my requirements_230828.txt to check torch version or something, this bug is weird. my video also bigger then 900 frame, but it didn't have any troble. you can find every video in the web and will get bug, let me try it.
I will send you, can you give me your email address
franktpmvu@gmail.com
update: bro, i cannot download that file, did you can find some open dataset video in internet then check it can run or not? e.g. mot17 cityscapes or something else?
if it's not a problem from video file i think maybe you can change the enviroment same with requirements_230828.txt file
I send you again. Are you train OSTrack on UAV123 dataset?
ok first i transform your file to mp4, and i running below, after 5k it seems like good: python tracking/video_demo_neighbor.py ostrack vitb_384_mae_ce_32x4_ep300_neighbor Pickups_Circle_Tower.mp4 --optional_box 344 226 37 27 --save_results --debug 0 --save_img
Ok so all I need is just change the format file to mp4? about the second question?
about your bug, you can try transform to mp4, maybe it can fix that, if it's not, i sugest you to change your enviroment equal to my requirements_230828.txt
about output video, you can read that images and use cv2.VideoCapture to capture all the image to the one video.
when i try running sh "example_ostrack_install.sh (line 115)" this error pops up; Traceback (most recent call last): File "tracking/create_default_local_file.py", line 5, in
from lib.test.evaluation import create_default_local_file_ITP_test
File "/home/pc//object-tracking/NeighborTrack/trackers/ostrack/tracking/../lib/test/evaluation/init.py", line 2, in
from .tracker import Tracker, trackerlist, NeighborTracker
File "/home/pc/ /object-tracking/NeighborTrack/trackers/ostrack/tracking/../lib/test/evaluation/tracker.py", line 13, in
from NeighborTrack.neighbortrack import neighbortrack
ModuleNotFoundError: No module named 'NeighborTrack'
i created data and output directories but it still makes this error.