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

Using Detectron2 on CPU #12

Open
jan-schaeffer opened this issue Jul 29, 2022 · 3 comments
Open

Using Detectron2 on CPU #12

jan-schaeffer opened this issue Jul 29, 2022 · 3 comments

Comments

@jan-schaeffer
Copy link

Hi,

first of all, big thanks for this project!

I am currently working on somethng very similar to the BibItem example you provide here.

Unfortunately, I am having an issue with running the train_net.py. Since I am on a M1 Mac, I do not have CUDA support, though your script assumes it. This causes the following error:

File "/opt/miniconda3/envs/lp/lib/python3.10/site-packages/torch/cuda/__init__.py", line 211, in _lazy_init raise AssertionError("Torch not compiled with CUDA enabled") AssertionError: Torch not compiled with CUDA enabled

Is there any way to change this? I found this and this online, though I am not sure on where to add this in the script.

Any help would be highly appreciated since I need to train a custom model for a work project.

Thanks,

Jan

@cmeer
Copy link

cmeer commented Sep 17, 2022

I have the same problem

@cmeer
Copy link

cmeer commented Sep 17, 2022

I got a step further.

In the file train_net.py just above the lines (around line 138):
cfg.freeze()
default_setup(cfg, args)

you have to put:
cfg.MODEL.DEVICE = 'cpu'

After that i had to modify my train_bib.sh file to.
python train_net.py
--dataset_name bib-item
--json_annotation_train ../data/bib/train.json
--image_path_train ../data/bib/
--json_annotation_val ../data/bib/test.json
--image_path_val ../data/bib/
--config-file ../configs/prima/fast_rcnn_R_50_FPN_3x.yaml
OUTPUT_DIR ../outputs/bib/fast_rcnn_R_50_FPN_3x/
SOLVER.IMS_PER_BATCH 2

From mask_rcnn to fast_rcnn.

I followed https://www.youtube.com/watch?v=puOKTFXRyr4 this tutorial.

It seems to be training now.

@rodrigo1990
Copy link

I got a step further.

In the file train_net.py just above the lines (around line 138): cfg.freeze() default_setup(cfg, args)

you have to put: cfg.MODEL.DEVICE = 'cpu'

After that i had to modify my train_bib.sh file to. python train_net.py --dataset_name bib-item --json_annotation_train ../data/bib/train.json --image_path_train ../data/bib/ --json_annotation_val ../data/bib/test.json --image_path_val ../data/bib/ --config-file ../configs/prima/fast_rcnn_R_50_FPN_3x.yaml OUTPUT_DIR ../outputs/bib/fast_rcnn_R_50_FPN_3x/ SOLVER.IMS_PER_BATCH 2

From mask_rcnn to fast_rcnn.

I followed https://www.youtube.com/watch?v=puOKTFXRyr4 this tutorial.

It seems to be training now.

also it works for me !

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

3 participants