yolox_keypoint_segment icon indicating copy to clipboard operation
yolox_keypoint_segment copied to clipboard

I Can not run the demo.py

Open Bingo851 opened this issue 3 years ago • 6 comments

I already download the standard pretrain weights, and do as the README, I run the cmd "python tools/demo_old.py image -n yolox-s -c weights/yolox_s.pth --path assets/dog.jpg --conf 0.25 --nms 0.45 --tsize 640 --save_result --device cpu", the error is : AttributeError: 'YOLOXHead' object has no attribute 'strides' How can I fix this?

Bingo851 avatar Jan 17 '22 15:01 Bingo851

I've fixed the code

mcmingchang avatar Jan 18 '22 08:01 mcmingchang

thank u so much ! I also try to retrain the yolo-seg on COCO with the cmd python tools/train.py -n yolox-seg -d 8 -b 64 -o, but there was an error:

`UserWarning: semaphore_tracker: There appear to be 8 leaked semaphores to clean up at shutdown len(cache))

Traceback (most recent call last):

File "tools/train.py", line 133, in

args=(exp, args),

File "/home/zhaobin/workspace/yolox_keypoint_segment/yolox/core/launch.py", line 95, in launch

start_method=start_method,

File "/usr/local/lib/python3.6/dist-packages/torch/multiprocessing/spawn.py", line 188, in start_processes

while not context.join():

File "/usr/local/lib/python3.6/dist-packages/torch/multiprocessing/spawn.py", line 136, in join

signal_name=name

torch.multiprocessing.spawn.ProcessExitedException: process 0 terminated with signal SIGKILL`

my machine is 24 cpu cores, 384G RAM, 8 GPUs(RTX 3090) , I've try to set the batchsize smaller, but this error still occured! Could u help me about this ?

Bingo851 avatar Jan 21 '22 02:01 Bingo851

you can use -d 1 -b 8,i will fix this bug today

mcmingchang avatar Jan 21 '22 03:01 mcmingchang

-d 1 -b 8 num_worker =4 -d 2 -b 16 num_worker =4 -d 3 -b 24 num_worker =4 -d 4 -b 32 num_worker =2

I suspect that the thread is repeatedly called. This problem appears in the original yolox. Now this problem will occur with coco generator, but the custom generator has not found the problem yet. Control num with coco generator,just the number of num_workers

mcmingchang avatar Jan 21 '22 03:01 mcmingchang

I found that when i set -d 4 , the CPU memory-used was 260G , when i changed -d 2, the CPU memory-used was 130G, the other args were same. Then I found the coding below will reload seg annotations , and the reload times depended on -d, yolox/exp/yolox_base.py with wait_for_the_master(local_rank): print("cur rank:{}".format(local_rank)) dataset = COCODataset( data_dir=self.data_dir, json_file=self.train_ann, img_size=self.input_size, keypoints=self.keypoints, segcls=self.segcls, random_dataset=self.random_dataset, preproc=TrainTransform( max_labels=50, flip_prob=self.flip_prob, hsv_prob=self.hsv_prob, keypoints=self.keypoints, segcls=self.segcls), cache=cache_img, )

yolox/data/datasets/coco.py `self.coco = COCO(os.path.join(self.data_dir, "annotations", self.json_file)) catNms = ['bed'] self.class_ids = sorted(self.coco.getCatIds()) self.ids = self.coco.getImgIds(catIds=self.coco.getCatIds(catNms)) # self.ids = self.coco.getImgIds()

        cats = self.coco.loadCats(self.class_ids)
        self._classes = tuple([c["name"] for c in cats])
        logger.info( "load cats for: {}, totoal imgs:{}".format(catNms,len(self.ids)))
        self.annotations = self._load_coco_annotations()         # this will reload in each process

`

I want to know how can i fix this?

Bingo851 avatar Feb 25 '22 10:02 Bingo851

update the code and try it again

mcmingchang avatar Mar 02 '22 09:03 mcmingchang