cvat-ai / cvat

Annotate better with CVAT, the industry-leading data engine for machine learning. Used and trusted by teams at any scale, for data of any scale.
https://cvat.ai
MIT License
12.46k stars 2.99k forks source link

Can you tell me how to add new DL by my self #2776

Closed xs818818 closed 3 years ago

xs818818 commented 3 years ago

metadata: name: darknet-yolov4 namespace: cvat annotations: name: yolov4 type: detector spec: | [ { "id": 1, "name": "person" }, { "id": 2, "name": "bicycle" }, { "id": 3, "name": "car" }, { "id": 4, "name": "motorbike" }, { "id": 5, "name": "aeroplane" }, { "id": 6, "name": "bus" }, { "id": 8, "name": "train" }, { "id": 9, "name": "truck" }, { "id": 10, "name": "boat" }, { "id": 11, "name": "traffic light" }, { "id": 12, "name": "fire hydrant" }, { "id": 13, "name": "stop sign" }, { "id": 14, "name": "parking meter" }, { "id": 15, "name": "bird" }, { "id": 16, "name": "cat" }, { "id": 17, "name": "dog" }, { "id": 18, "name": "horse" }, { "id": 19, "name": "sheep" }, { "id": 20, "name": "cow" }, { "id": 21, "name": "elephant" }, { "id": 22, "name": "bear" }, { "id": 23, "name": "zebra" }, { "id": 24, "name": "giraffe" }, { "id": 25, "name": "backpack" }, { "id": 26, "name": "umbrella" }, { "id": 27, "name": "handbag" }, { "id": 28, "name": "tie" }, { "id": 29, "name": "suitcase" }, { "id": 30, "name": "frisbee" }, { "id": 31, "name": "skis" }, { "id": 32, "name": "snowboard" }, { "id": 33, "name": "sports ball" }, { "id": 34, "name": "kite" }, { "id": 35, "name": "baseball bat" }, { "id": 36, "name": "baseball glove" }, { "id": 37, "name": "skateboard" }, { "id": 38, "name": "surfboard" }, { "id": 39, "name": "tennis racket" }, { "id": 40, "name": "bottle" }, { "id": 41, "name": "wine glass" }, { "id": 42, "name": "cup" }, { "id": 43, "name": "fork" }, { "id": 44, "name": "knife" }, { "id": 45, "name": "spoon" }, { "id": 46, "name": "bowl" }, { "id": 47, "name": "banana" }, { "id": 48, "name": "apple" }, { "id": 49, "name": "sandwich" }, { "id": 50, "name": "orange" }, { "id": 51, "name": "broccoli" }, { "id": 52, "name": "carrot" }, { "id": 53, "name": "hot dog" }, { "id": 54, "name": "pizza" }, { "id": 55, "name": "donut" }, { "id": 56, "name": "cake" }, { "id": 57, "name": "chair" }, { "id": 58, "name": "sofa" }, { "id": 59, "name": "pottedplant" }, { "id": 60, "name": "bed" }, { "id": 61, "name": "diningtable" }, { "id": 62, "name": "toilet" }, { "id": 63, "name": "tvmonitor" }, { "id": 64, "name": "laptop" }, { "id": 65, "name": "mouse" }, { "id": 66, "name": "remote" }, { "id": 67, "name": "keyboard" }, { "id": 68, "name": "cell phone" }, { "id": 69, "name": "microwave" }, { "id": 70, "name": "oven" }, { "id": 71, "name": "toaster" }, { "id": 72, "name": "sink" }, { "id": 73, "name": "refrigerator" }, { "id": 74, "name": "book" }, { "id": 75, "name": "clock" }, { "id": 76, "name": "vase" }, { "id": 77, "name": "scissors" }, { "id": 78, "name": "teddy bear" }, { "id": 79, "name": "hair drier" }, { "id": 80, "name": "toothbrush" }, ] framework: darknet

spec: description: yolov4 from darknet Object Detection API runtime: 'python:3.6' handler: main:handler eventTimeout: 30s

build: image: cvat/darknet.yolov4 baseImage: baoxin/darknet

directives:
  preCopy:
    - kind: WORKDIR
      value: /opt/nuclio
    - kind: RUN
      value: pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple msgpack nuclio_sdk Pillow pyyaml

triggers: myHttpTrigger: maxWorkers: 2 kind: 'http' workerAvailabilityTimeoutMilliseconds: 10000 attributes: maxRequestBodySize: 33554432 # 32MB

platform: attributes: restartPolicy: name: always maximumRetryCount: 3 This is my function.yaml nuclio :8070/projects/cvat/functions is running but cvat Could not get models from the server Open the Browser Console to get details

xs818818 commented 3 years ago

If i only use siammask i will success

spatra007 commented 3 years ago

Hi @xs818818 , were you able to run this? I am stuck with this in my project and I want to deploy my custom yolov4 darknet model in Nuclio for CVAT auto annotations. Can you share the function and yaml file or atleast a way so that I can refer how to make it work?

nmanovic commented 3 years ago

@spatra007 , please start to read the tutorial. I hope it can help you. https://github.com/openvinotoolkit/cvat/pull/3124

gautami-yara commented 3 years ago

@nmanovic Hi, the tutorial at #3124 is not very helpful as it does tell us how we can change the function.yaml file to upload our own custom Yolov3 models from local machine. Can you please help us?

nmanovic commented 3 years ago

@gautami-yara , could you please describe your issue? The tutorial describes how to create a serverless function from scratch. Thus it should answer how to update function.yaml file. I will be happy to answer on a specific question.

gautami-yara commented 3 years ago

@nmanovic Thank you for replying so promptly. I have built a custom YoloV3 model in my local machine. I am not sure what parameters are supposed to be added in the 'Directives' section in function.yaml file to deploy the model on nuclio. Currently, the tutorial (specifically retinanet) only tells how to use opensource models from model zoos.

nmanovic commented 3 years ago

Directives section should contain steps to re-create your local environment inside a docker container. For example, locally you can have interface.py script to run inference of your model. The script depends on a number of python packages. Thus you have to install them. The script can rely on Python3. Thus it has to be available inside the docker container.

https://openvinotoolkit.github.io/cvat/docs/manual/advanced/serverless-tutorial/#dl-model-as-a-serverless-function

When we know how to run the DL model locally, we can prepare a serverless function which can be used by CVAT to annotate data. Let’s see how function.yaml will look like…

gautami-yara commented 3 years ago

@nmanovic I understand now. Does this also mean that we can deploy models in every format (.h5, .onnx, .pb, etc) as long as we install the correct python packages? Thank you!

nmanovic commented 3 years ago

@gautami-yara , basically you can do that ever you want as soon as your serverless function will accept and return expected json sctructures.