Skip to content

add detectron2 support - #322

Merged
fcakyon merged 120 commits into
obss:mainfrom
kadirnar:detectron
Jan 13, 2022
Merged

fcakyon merged 120 commits into
obss:mainfrom
kadirnar:detectron

Conversation

@kadirnar

Copy link
Copy Markdown
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

fcakyon commented Dec 30, 2021

Copy link
Copy Markdown
Collaborator

@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
Comment thread sahi/model.py Resolved
Comment thread tests/test_detectron2.py Resolved
Comment thread requirements.txt Resolved
Comment thread .github/workflows/ci.yml Resolved
@fcakyon

fcakyon commented Dec 31, 2021

Copy link
Copy Markdown
Collaborator

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

@kadirnar

kadirnar commented Jan 3, 2022

Copy link
Copy Markdown
Contributor Author

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

fcakyon commented Jan 3, 2022 •

Copy link
Copy Markdown
Collaborator

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

kadirnar commented Jan 3, 2022 •

Copy link
Copy Markdown
Contributor Author

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