microsoft / aerial_wildlife_detection

Tools for detecting wildlife in aerial images using active learning
MIT License
226 stars 58 forks source link

column "annotationtype" does not exist #43

Closed ctorney closed 3 years ago

ctorney commented 3 years ago

Hi Beni I'm just looking at the new code and I get an error after running the migrate aide script and opening the model marketplace tab. The script doesn't seem to include the annotation/prediction types in the model marketplace table

bkellenb commented 3 years ago

Hi Colin, You are right, these fields were not in the migration script. I just added them with the latest commit. Please pull and restart AIDE (the migration script should be executed automatically during boot). Thanks a lot!

ctorney commented 3 years ago

Thanks - that's fixed it.

I have another couple of issues with the model marketplace

{"defs":{},"options":{"id":"options","name":"Options","style":{"hideHeader":true,"showBorder":true},"general":{"id":"general","name":"general","style":{"showBorder":true},"seed":{"id":"seed","name":"seed","style":{"showBorder":true}}},"model":{"id":"model","name":"model","style":{"showBorder":true},"kwargs":{"id":"kwargs","name":"kwargs","style":{"showBorder":true},"pretrained":{"id":"pretrained","name":"pretrained","style":{"showBorder":true}},"alltrain":{"id":"alltrain","name":"alltrain","style":{"showBorder":true}},"init_weights":{"id":"init_weights","name":"init_weights","style":{"showBorder":true}}}},"train":{"id":"train","name":"train","style":{"showBorder":true},"width":{"id":"width","name":"width","style":{"showBorder":true}},"height":{"id":"height","name":"height","style":{"showBorder":true}},"batch_size":{"id":"batch_size","name":"batch_size","style":{"showBorder":true}},"dataLoader":{"id":"dataLoader","name":"dataLoader","style":{"showBorder":true},"kwargs":{"id":"kwargs","name":"kwargs","style":{"showBorder":true},"shuffle":{"id":"shuffle","name":"shuffle","style":{"showBorder":true}},"batch_size":{"id":"batch_size","name":"batch_size","style":{"showBorder":true}}}},"optim":{"id":"optim","name":"optim","style":{"showBorder":true},"class":{"id":"class","name":"class","style":{"showBorder":true}},"kwargs":{"id":"kwargs","name":"kwargs","style":{"showBorder":true},"learning_rate":{"id":"learning_rate","name":"learning_rate","style":{"showBorder":true}}}},"transform":{"id":"transform","name":"transform","style":{"showBorder":true},"class":{"id":"class","name":"class","style":{"showBorder":true}},"kwargs":{"id":"kwargs","name":"kwargs","style":{"showBorder":true},"transforms":{"0":{"id":"0","name":"0","style":{"showBorder":true},"class":{"id":"class","name":"class","style":{"showBorder":true}},"kwargs":{"id":"kwargs","name":"kwargs","style":{"showBorder":true},"patchSize":{"0":{"id":"0","name":"0","style":{"showBorder":true}},"1":{"id":"1","name":"1","style":{"showBorder":true}},"id":"patchSize","name":"patchSize","style":{"showBorder":true}},"jitter":{"id":"jitter","name":"jitter","style":{"showBorder":true}},"limitBorders":{"id":"limitBorders","name":"limitBorders","style":{"showBorder":true}},"objectProbability":{"id":"objectProbability","name":"objectProbability","style":{"showBorder":true}}}},"1":{"id":"1","name":"1","style":{"showBorder":true},"class":{"id":"class","name":"class","style":{"showBorder":true}},"kwargs":{"id":"kwargs","name":"kwargs","style":{"showBorder":true},"p":{"id":"p","name":"p","style":{"showBorder":true}}}},"id":"transforms","name":"transforms","style":{"showBorder":true}}}},"criterion":{"id":"criterion","name":"criterion","style":{"showBorder":true},"class":{"id":"class","name":"class","style":{"showBorder":true}},"kwargs":{"id":"kwargs","name":"kwargs","style":{"showBorder":true},"NO_OBJECT_SCALE":{"id":"NO_OBJECT_SCALE","name":"NO_OBJECT_SCALE","style":{"showBorder":true}},"OBJECT_SCALE":{"id":"OBJECT_SCALE","name":"OBJECT_SCALE","style":{"showBorder":true}},"COORD_SCALE":{"id":"COORD_SCALE","name":"COORD_SCALE","style":{"showBorder":true}},"CLASS_SCALE":{"id":"CLASS_SCALE","name":"CLASS_SCALE","style":{"showBorder":true}}}},"ignore_unsure":{"id":"ignore_unsure","name":"ignore_unsure","style":{"showBorder":true}}},"inference":{"id":"inference","name":"inference","style":{"showBorder":true},"shuffle":{"id":"shuffle","name":"shuffle","style":{"showBorder":true}},"batch_size":{"id":"batch_size","name":"batch_size","style":{"showBorder":true}},"nms_thresh":{"id":"nms_thresh","name":"nms_thresh","style":{"showBorder":true}},"cls_thresh":{"id":"cls_thresh","name":"cls_thresh","style":{"showBorder":true}},"transform":{"id":"transform","name":"transform","style":{"showBorder":true},"class":{"id":"class","name":"class","style":{"showBorder":true}},"kwargs":{"id":"kwargs","name":"kwargs","style":{"showBorder":true},"transforms":{"0":{"id":"0","name":"0","style":{"showBorder":true},"class":{"id":"class","name":"class","style":{"showBorder":true}},"kwargs":{"id":"kwargs","name":"kwargs","style":{"showBorder":true},"size":{"0":{"id":"0","name":"0","style":{"showBorder":true}},"1":{"id":"1","name":"1","style":{"showBorder":true}},"id":"size","name":"size","style":{"showBorder":true}}}},"id":"transforms","name":"transforms","style":{"showBorder":true}}}},"dataLoader":{"id":"dataLoader","name":"dataLoader","style":{"showBorder":true},"kwargs":{"id":"kwargs","name":"kwargs","style":{"showBorder":true},"shuffle":{"id":"shuffle","name":"shuffle","style":{"showBorder":true}},"batch_size":{"id":"batch_size","name":"batch_size","style":{"showBorder":true}}}}}}}

whereas before the original settings were: {"general":{"seed":1234},"model":{"kwargs":{"pretrained":true,"alltrain":false,"init_weights":"weights/trained-camera-trap-yolo.h5"}},"train":{"width":864,"height":864,"batch_size":4,"dataLoader":{"kwargs":{"shuffle":true,"batch_size":1}},"optim":{"class":"tensorflow.keras.optimizers.Adam","kwargs":{"learning_rate":1e-7}},"transform":{"class":"ai.models.tensorflow.functional.transforms.boundingBoxes.Compose","kwargs":{"transforms":[{"class":"ai.models.tensorflow.functional.transforms.boundingBoxes.RandomClip","kwargs":{"patchSize":[864,864],"jitter":0,"limitBorders":true,"objectProbability":1}},{"class":"ai.models.tensorflow.functional.transforms.boundingBoxes.RandomHorizontalFlip","kwargs":{"p":0.5}}]}},"criterion":{"class":"ai.models.tensorflow.functional._yolo_3.loss.YoloLoss","kwargs":{"NO_OBJECT_SCALE":1,"OBJECT_SCALE":5,"COORD_SCALE":4,"CLASS_SCALE":2}},"ignore_unsure":true},"inference":{"shuffle":false,"batch_size":4,"nms_thresh":0.1,"cls_thresh":0.1,"width":2592,"height":1952,"transform":{"class":"ai.models.tensorflow.functional.transforms.boundingBoxes.Compose","kwargs":{"transforms":[{"class":"ai.models.tensorflow.functional.transforms.boundingBoxes.Resize","kwargs":{"size":[1952,2592]}}]}},"dataLoader":{"kwargs":{"shuffle":false,"batch_size":4}}}}

Later when I try to run inference or training it can't process the options so goes with the defaults.

bkellenb commented 3 years ago

Hi Colin,

I just fixed the first problem with the latest commit; it should now be possible to import JSON files, too.

For the second issue: those new settings come from the "optionsEngine", a means within AIDE to format model settings in a user-friendly way. However, by default this is only used within the built-in models, more specifically within models that subclass one of the following class definitions or children:

Is your model by chance a subclass of one of those? In that case the culprit lies in the model class function verifyOptions(cls, options), which is called upon saving model settings to verify whether the provided settings are syntactically valid.

A quick fix would be to define this function as a dummy in your custom model class:

class CustomModel(AIModel):

    @classmethod
    def verifyOptions(cls, options):
        # not recommended, but quick fix: just assume options are correct
        return True

See here for more information on options verification.

In general, we may want to check your custom model implementation together. AIDE v2.0 introduced some changes (e.g., on the new mapping between model and project label classes) that might cause your model not to work properly, especially when re-shared and re-imported on the Model Marketplace. Please let me know about this and I can try to bring your model up to date with the latest changes if time permits.

ctorney commented 3 years ago

Thanks - I see now the problem. I had included an options key but hadn't used the correct format for the pretty print approach. I took out the 'options' base key and t's working now with as a plain text options file. I'm not subclassing those built-in models but I'll have a look at updating to the options engine.

Single file json import working now too. Thanks again