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

add detectron2 support #322

Merged
merged 120 commits into from
Jan 13, 2022
Merged

add detectron2 support #322

merged 120 commits into from
Jan 13, 2022

Conversation

kadirnar
Copy link
Contributor

Sahi algoritmasına detectron2 kütüphanesini eklenmesi amaçlanmıştır.

Yapılan Değişiklikler:

Model.py: class Detectron2Model(DetectionModel) sınıfı eklendi.
utils/detectron2.py: Test cfg kodu ve .pkl yolları eklendi.
tests/test_detectron2.py: Modelin test edilmesi için test_detectron2.py dosyası oluşturuldu.

@fcakyon fcakyon changed the title Adding detectron2 models to the Sahi algorithm. add detectron2 support Dec 30, 2021
@fcakyon
Copy link
Collaborator

fcakyon commented Dec 30, 2021

@kadirnar katkilarindan dolayi cok tesekkurler, baya guzel duruyor PR 🚀

Kodlarini su basliktaki adimlari takip ederek isort ve black ile formatlayip commitleyip tekrar pushlayabilir misin forkuna?
https://github.com/obss/sahi#contributing

@fcakyon fcakyon linked an issue Dec 30, 2021 that may be closed by this pull request
@fcakyon fcakyon added the enhancement New feature or request label Dec 30, 2021
@fcakyon fcakyon self-requested a review December 30, 2021 20:26
sahi/model.py Outdated Show resolved Hide resolved
tests/test_detectron2.py Outdated Show resolved Hide resolved
requirements.txt Outdated Show resolved Hide resolved
.github/workflows/ci.yml Outdated Show resolved Hide resolved
@fcakyon
Copy link
Collaborator

fcakyon commented Dec 31, 2021

@kadirnar isort ve black ile tekrar formatlaman gerekiyor, sahi/model.py formati hata veriyor :)

@kadirnar
Copy link
Contributor Author

kadirnar commented Jan 3, 2022

Config_path değişkenin hatası halen devam etmektedir.

join() argument must be str, bytes, or os.PathLike object, not 'NoneType'
01/03/2022 17:46:48 - INFO - fvcore.common.checkpoint -   [Checkpointer] Loading from mask_rcnn_R_50_C4_3x.pth ...
01/03/2022 17:46:49 - WARNING - fvcore.common.checkpoint -   Skip loading parameter 'roi_heads.box_predictor.cls_score.weight' to the model due to incompatible shapes: (446, 2048) in the checkpoint but (81, 2048) in the model! You might want to double check if this is expected.
01/03/2022 17:46:49 - WARNING - fvcore.common.checkpoint -   Skip loading parameter 'roi_heads.box_predictor.cls_score.bias' to the model due to incompatible shapes: (446,) in the checkpoint but (81,) in the model! You might want to double check if this is expected.
01/03/2022 17:46:49 - WARNING - fvcore.common.checkpoint -   Skip loading parameter 'roi_heads.box_predictor.bbox_pred.weight' to the model due to incompatible shapes: (1780, 2048) in the checkpoint but (320, 2048) in the model! You might want to double check if this is expected.
01/03/2022 17:46:49 - WARNING - fvcore.common.checkpoint -   Skip loading parameter 'roi_heads.box_predictor.bbox_pred.bias' to the model due to incompatible shapes: (1780,) in the checkpoint but (320,) in the model! You might want to double check if this is expected.
01/03/2022 17:46:49 - WARNING - fvcore.common.checkpoint -   Some model parameters or buffers are not found in the checkpoint:
roi_heads.box_predictor.bbox_pred.{bias, weight}
roi_heads.box_predictor.cls_score.{bias, weight}
01/03/2022 17:46:49 - WARNING - fvcore.common.checkpoint -   The checkpoint state_dict contains keys that are not used by the model:
  roi_heads.mask_head.deconv.{bias, weight}
  roi_heads.mask_head.predictor.{bias, weight}
Traceback (most recent call last):
  File "/home/kadir/Desktop/sahi/open.py", line 18, in <module>
    detection_model = Detectron2DetectionModel(
  File "/home/kadir/Desktop/sahi/sahi/model.py", line 70, in __init__
    self.load_model()
  File "/home/kadir/Desktop/sahi/sahi/model.py", line 536, in load_model
    metadata = MetadataCatalog.get(cfg.DATASETS.TRAIN[0])
IndexError: tuple index out of range

@fcakyon
Copy link
Collaborator

fcakyon commented Jan 3, 2022

Config_path değişkenin hatası halen devam etmektedir.

join() argument must be str, bytes, or os.PathLike object, not 'NoneType'
01/03/2022 17:46:48 - INFO - fvcore.common.checkpoint -   [Checkpointer] Loading from mask_rcnn_R_50_C4_3x.pth ...
01/03/2022 17:46:49 - WARNING - fvcore.common.checkpoint -   Skip loading parameter 'roi_heads.box_predictor.cls_score.weight' to the model due to incompatible shapes: (446, 2048) in the checkpoint but (81, 2048) in the model! You might want to double check if this is expected.
01/03/2022 17:46:49 - WARNING - fvcore.common.checkpoint -   Skip loading parameter 'roi_heads.box_predictor.cls_score.bias' to the model due to incompatible shapes: (446,) in the checkpoint but (81,) in the model! You might want to double check if this is expected.
01/03/2022 17:46:49 - WARNING - fvcore.common.checkpoint -   Skip loading parameter 'roi_heads.box_predictor.bbox_pred.weight' to the model due to incompatible shapes: (1780, 2048) in the checkpoint but (320, 2048) in the model! You might want to double check if this is expected.
01/03/2022 17:46:49 - WARNING - fvcore.common.checkpoint -   Skip loading parameter 'roi_heads.box_predictor.bbox_pred.bias' to the model due to incompatible shapes: (1780,) in the checkpoint but (320,) in the model! You might want to double check if this is expected.
01/03/2022 17:46:49 - WARNING - fvcore.common.checkpoint -   Some model parameters or buffers are not found in the checkpoint:
roi_heads.box_predictor.bbox_pred.{bias, weight}
roi_heads.box_predictor.cls_score.{bias, weight}
01/03/2022 17:46:49 - WARNING - fvcore.common.checkpoint -   The checkpoint state_dict contains keys that are not used by the model:
  roi_heads.mask_head.deconv.{bias, weight}
  roi_heads.mask_head.predictor.{bias, weight}
Traceback (most recent call last):
  File "/home/kadir/Desktop/sahi/open.py", line 18, in <module>
    detection_model = Detectron2DetectionModel(
  File "/home/kadir/Desktop/sahi/sahi/model.py", line 70, in __init__
    self.load_model()
  File "/home/kadir/Desktop/sahi/sahi/model.py", line 536, in load_model
    metadata = MetadataCatalog.get(cfg.DATASETS.TRAIN[0])
IndexError: tuple index out of range

su satirda metadata'yi cekemiyor config verilmedigi icin: metadata = MetadataCatalog.get(cfg.DATASETS.TRAIN[0]).

metadatayi ne icin cekiyordun configden?

@kadirnar
Copy link
Contributor Author

kadirnar commented Jan 3, 2022

Config_path değişkenin hatası halen devam etmektedir.

join() argument must be str, bytes, or os.PathLike object, not 'NoneType'
01/03/2022 17:46:48 - INFO - fvcore.common.checkpoint -   [Checkpointer] Loading from mask_rcnn_R_50_C4_3x.pth ...
01/03/2022 17:46:49 - WARNING - fvcore.common.checkpoint -   Skip loading parameter 'roi_heads.box_predictor.cls_score.weight' to the model due to incompatible shapes: (446, 2048) in the checkpoint but (81, 2048) in the model! You might want to double check if this is expected.
01/03/2022 17:46:49 - WARNING - fvcore.common.checkpoint -   Skip loading parameter 'roi_heads.box_predictor.cls_score.bias' to the model due to incompatible shapes: (446,) in the checkpoint but (81,) in the model! You might want to double check if this is expected.
01/03/2022 17:46:49 - WARNING - fvcore.common.checkpoint -   Skip loading parameter 'roi_heads.box_predictor.bbox_pred.weight' to the model due to incompatible shapes: (1780, 2048) in the checkpoint but (320, 2048) in the model! You might want to double check if this is expected.
01/03/2022 17:46:49 - WARNING - fvcore.common.checkpoint -   Skip loading parameter 'roi_heads.box_predictor.bbox_pred.bias' to the model due to incompatible shapes: (1780,) in the checkpoint but (320,) in the model! You might want to double check if this is expected.
01/03/2022 17:46:49 - WARNING - fvcore.common.checkpoint -   Some model parameters or buffers are not found in the checkpoint:
roi_heads.box_predictor.bbox_pred.{bias, weight}
roi_heads.box_predictor.cls_score.{bias, weight}
01/03/2022 17:46:49 - WARNING - fvcore.common.checkpoint -   The checkpoint state_dict contains keys that are not used by the model:
  roi_heads.mask_head.deconv.{bias, weight}
  roi_heads.mask_head.predictor.{bias, weight}
Traceback (most recent call last):
  File "/home/kadir/Desktop/sahi/open.py", line 18, in <module>
    detection_model = Detectron2DetectionModel(
  File "/home/kadir/Desktop/sahi/sahi/model.py", line 70, in __init__
    self.load_model()
  File "/home/kadir/Desktop/sahi/sahi/model.py", line 536, in load_model
    metadata = MetadataCatalog.get(cfg.DATASETS.TRAIN[0])
IndexError: tuple index out of range

su satirda metadata'yi cekemiyor config verilmedigi icin: metadata = MetadataCatalog.get(cfg.DATASETS.TRAIN[0]).

metadatayi ne icin cekiyordun configden?

Veri seti hakkında bilgi almak için kullanıyorduk. Bunu farklı modüller ile çözmek için araştıracağım. Şuanlık en basit yöntem:

cfg.MODEL.ROI_HEADS.NUM_CLASSES = 

@fcakyon fcakyon merged commit c7a930f into obss:main Jan 13, 2022
@kadirnar kadirnar deleted the detectron branch January 27, 2022 11:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Question: Plans for Deterctron2?
2 participants