Skip to content
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

I Can not run the demo.py #2

Open
Bingo851 opened this issue Jan 17, 2022 · 6 comments
Open

I Can not run the demo.py #2

Bingo851 opened this issue Jan 17, 2022 · 6 comments

Comments

@Bingo851
Copy link

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?

@mcmingchang
Copy link
Owner

I've fixed the code

@Bingo851 Bingo851 reopened this Jan 21, 2022
@Bingo851
Copy link
Author

Bingo851 commented Jan 21, 2022

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 ?

@mcmingchang
Copy link
Owner

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

@mcmingchang
Copy link
Owner

mcmingchang commented Jan 21, 2022

-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

@Bingo851
Copy link
Author

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?

@mcmingchang
Copy link
Owner

update the code and try it again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants