Update mujtaba_object_detection_code_export.py
Browse files
mujtaba_object_detection_code_export.py
CHANGED
|
@@ -1,13 +1,9 @@
|
|
| 1 |
-
# -*- coding: utf-8 -*-
|
| 2 |
-
"""mujtaba_object_detection_code_export.ipynb
|
| 3 |
|
| 4 |
-
Automatically generated by Colab.
|
| 5 |
|
| 6 |
-
Original file is located at
|
| 7 |
-
https://colab.research.google.com/drive/1RgE9mbEiNBuPutxI86fIewscERKHyOr_
|
| 8 |
-
"""
|
| 9 |
|
| 10 |
-
|
|
|
|
|
|
|
| 11 |
|
| 12 |
import os
|
| 13 |
import cv2
|
|
@@ -18,7 +14,8 @@ import wandb
|
|
| 18 |
import matplotlib.pyplot as plt
|
| 19 |
from datetime import datetime
|
| 20 |
from google.colab import userdata
|
| 21 |
-
|
|
|
|
| 22 |
wandb.login(key=userdata.get('WANDB'))
|
| 23 |
|
| 24 |
def setup_wandb():
|
|
@@ -125,7 +122,8 @@ def main():
|
|
| 125 |
|
| 126 |
if __name__ == "__main__":
|
| 127 |
main()
|
| 128 |
-
|
|
|
|
| 129 |
from google.colab import files
|
| 130 |
|
| 131 |
files.download("runs/detect/train/weights/best.torchscript")
|
|
|
|
|
|
|
|
|
|
| 1 |
|
|
|
|
| 2 |
|
|
|
|
|
|
|
|
|
|
| 3 |
|
| 4 |
+
|
| 5 |
+
# these are the libraries you have to isntall for this projet
|
| 6 |
+
#!pip install ultralytics datasets wandb gradio opencv-python Pillow captum torchvision --upgrade
|
| 7 |
|
| 8 |
import os
|
| 9 |
import cv2
|
|
|
|
| 14 |
import matplotlib.pyplot as plt
|
| 15 |
from datetime import datetime
|
| 16 |
from google.colab import userdata
|
| 17 |
+
# below is the api key's name I had set in my google colab's secret key name to ensure privacy for my api key . If you want
|
| 18 |
+
# you can create an accoint at WANDB and then download name the api key WANDB and then use it for your personal use
|
| 19 |
wandb.login(key=userdata.get('WANDB'))
|
| 20 |
|
| 21 |
def setup_wandb():
|
|
|
|
| 122 |
|
| 123 |
if __name__ == "__main__":
|
| 124 |
main()
|
| 125 |
+
# main objective of this colab filw was to generate wegihts after training and thne later downlaod and upload to hugging face for inference
|
| 126 |
+
#as you cannot directly run of hugging due to absence of gpu
|
| 127 |
from google.colab import files
|
| 128 |
|
| 129 |
files.download("runs/detect/train/weights/best.torchscript")
|