-
Notifications
You must be signed in to change notification settings - Fork 620
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 automodel structure for unified model loading #469
Conversation
add automodel structure for unified model loading (obss#469)
@@ -540,7 +535,7 @@ def predict( | |||
tqdm.write("Prediction time is: {:.2f} ms".format(prediction_result.durations_in_seconds["prediction"] * 1000)) | |||
|
|||
if dataset_json_path: | |||
if source_is_video == True: | |||
if source_is_video is True: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just using if source_is_video
is enough
|
||
from sahi.utils.file import import_model_class | ||
|
||
MODEL_TYPE_TO_MODEL_CLASS_NAME = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this registry should be better as class variable inside AutoDetectionModel. Also, why don't save the classes directly instead of saving only their name?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes better move it inside the class.
saved only the names to avoid adding a new module import once a new detector model support is added. this way we only need to update a list of string (instead of adding module import).
can switch to saving directly the classes if its a better practice.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why don't you want to avoid imports? Are they too expensive (I doubt it) or some of them require installation of other packages? As for the better practice, this way one might miss some bugs e.g. incorrectly written class names would not be noticed until the interpreter tries to instantiate them during run time.
New
AutoDetectionModel
class makes it easier to load anyyolov5
,mmdet
,detectron2
model!