mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-12 22:25:24 +03:00
102 lines
3.9 KiB
Plaintext
102 lines
3.9 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {
|
|
"id": "rmuF9iKWTbdk"
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"! pip install -q super_gradients==3.7.1"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {
|
|
"id": "dTB0jy_NNSFz"
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"from super_gradients.common.object_names import Models\n",
|
|
"from super_gradients.conversion import DetectionOutputFormatMode\n",
|
|
"from super_gradients.training import models\n",
|
|
"\n",
|
|
"model = models.get(Models.YOLO_NAS_S, pretrained_weights=\"coco\")"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {
|
|
"id": "GymUghyCNXem"
|
|
},
|
|
"outputs": [],
|
|
"source": [
|
|
"# export the model for compatibility with Frigate\n",
|
|
"\n",
|
|
"model.export(\"yolo_nas_s.onnx\",\n",
|
|
" output_predictions_format=DetectionOutputFormatMode.FLAT_FORMAT,\n",
|
|
" max_predictions_per_image=20,\n",
|
|
" confidence_threshold=0.4,\n",
|
|
" input_image_shape=(320,320),\n",
|
|
" )"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 4,
|
|
"metadata": {
|
|
"colab": {
|
|
"base_uri": "https://localhost:8080/",
|
|
"height": 17
|
|
},
|
|
"id": "uBhXV5g4Nh42",
|
|
"outputId": "303104fa-97dd-4efd-8b56-808e0ea00166"
|
|
},
|
|
"outputs": [
|
|
{
|
|
"data": {
|
|
"application/javascript": "\n async function download(id, filename, size) {\n if (!google.colab.kernel.accessAllowed) {\n return;\n }\n const div = document.createElement('div');\n const label = document.createElement('label');\n label.textContent = `Downloading \"${filename}\": `;\n div.appendChild(label);\n const progress = document.createElement('progress');\n progress.max = size;\n div.appendChild(progress);\n document.body.appendChild(div);\n\n const buffers = [];\n let downloaded = 0;\n\n const channel = await google.colab.kernel.comms.open(id);\n // Send a message to notify the kernel that we're ready.\n channel.send({})\n\n for await (const message of channel.messages) {\n // Send a message to notify the kernel that we're ready.\n channel.send({})\n if (message.buffers) {\n for (const buffer of message.buffers) {\n buffers.push(buffer);\n downloaded += buffer.byteLength;\n progress.value = downloaded;\n }\n }\n }\n const blob = new Blob(buffers, {type: 'application/binary'});\n const a = document.createElement('a');\n a.href = window.URL.createObjectURL(blob);\n a.download = filename;\n div.appendChild(a);\n a.click();\n div.remove();\n }\n ",
|
|
"text/plain": [
|
|
"<IPython.core.display.Javascript object>"
|
|
]
|
|
},
|
|
"metadata": {},
|
|
"output_type": "display_data"
|
|
},
|
|
{
|
|
"data": {
|
|
"application/javascript": "download(\"download_9976a3d8-3025-4b5b-b060-6a3aed3c752f\", \"yolo_nas_s.onnx\", 48803558)",
|
|
"text/plain": [
|
|
"<IPython.core.display.Javascript object>"
|
|
]
|
|
},
|
|
"metadata": {},
|
|
"output_type": "display_data"
|
|
}
|
|
],
|
|
"source": [
|
|
"from google.colab import files\n",
|
|
"\n",
|
|
"files.download('yolo_nas_s.onnx')"
|
|
]
|
|
}
|
|
],
|
|
"metadata": {
|
|
"colab": {
|
|
"provenance": []
|
|
},
|
|
"kernelspec": {
|
|
"display_name": "Python 3",
|
|
"name": "python3"
|
|
},
|
|
"language_info": {
|
|
"name": "python"
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 0
|
|
}
|