owaiskha9654 commited on
Commit
2fe4d4a
1 Parent(s): 57d24a3
Files changed (9) hide show
  1. Image1.jpg +0 -0
  2. Image2.jpg +0 -0
  3. Image3.jpg +0 -0
  4. Image4.jpg +0 -0
  5. Image5.jpg +0 -0
  6. Image6.jpg +0 -0
  7. README.md +5 -4
  8. app.py +48 -0
  9. requirements.txt +38 -0
Image1.jpg ADDED
Image2.jpg ADDED
Image3.jpg ADDED
Image4.jpg ADDED
Image5.jpg ADDED
Image6.jpg ADDED
README.md CHANGED
@@ -1,12 +1,13 @@
1
  ---
2
  title: Shelf Objects Detection Yolov7 Pytorch
3
- emoji: 📈
4
- colorFrom: gray
5
- colorTo: gray
6
  sdk: gradio
7
- sdk_version: 3.16.2
8
  app_file: app.py
9
  pinned: false
10
  ---
11
 
 
12
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
  title: Shelf Objects Detection Yolov7 Pytorch
3
+ emoji: 👀
4
+ colorFrom: yellow
5
+ colorTo: pink
6
  sdk: gradio
7
+ sdk_version: 3.1.4
8
  app_file: app.py
9
  pinned: false
10
  ---
11
 
12
+
13
  Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
app.py ADDED
@@ -0,0 +1,48 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ import gradio as gr
3
+ from huggingface_hub import hf_hub_download
4
+ from PIL import Image
5
+
6
+ REPO_ID = "thoucentric/Shelf_Objects_Detection_Yolov7_Pytorch"
7
+ FILENAME = "best.pt"
8
+
9
+
10
+ yolov7_custom_weights = hf_hub_download(repo_id=REPO_ID, filename=FILENAME)
11
+
12
+ model = torch.hub.load('',model='custom', path_or_model=yolov7_custom_weights, force_reload=True) # My Github repository https://github.com/Owaiskhan9654
13
+
14
+ def object_detection(im, size=640):
15
+ results = model(im)
16
+ results.render()
17
+ return Image.fromarray(results.imgs[0])
18
+
19
+ title = "Yolov7 Custom"
20
+
21
+ image = gr.inputs.Image(shape=(640, 640), image_mode="RGB", source="upload", label="Upload Image", optional=False)
22
+ outputs = gr.outputs.Image(type="pil", label="Output Image")
23
+
24
+ Custom_description="<center>Custom Training Performed on Kaggle <a href='https://www.kaggle.com/code/owaiskhan9654/shelf-object-detection-yolov7-pytorch/notebook' style='text-decoration: underline' target='_blank'>Link</a> </center><br> <center>Trainable bag-of-freebies sets new state-of-the-art for real-time object detectors </center> <br> on around 140 general items in Stores"
25
+
26
+ Footer = (
27
+ "<center>Model Trained by: Owais Ahmad Data Scientist at <b> Thoucentric </b> <a href=\"https://www.linkedin.com/in/owaiskhan9654/\">Visit Profile</a> <br></center>"
28
+
29
+ "<center> Model Trained Kaggle Kernel <a href=\"https://www.kaggle.com/code/owaiskhan9654/shelf-object-detection-yolov7-pytorch/notebook\">Link</a> <br></center>"
30
+
31
+
32
+ "<center> HuggingFace🤗 Model Deployed Repository <a href=\"https://huggingface.co/thoucentric/Shelf_Objects_Detection_Yolov7_Pytorch\">Link</a> <br></center>"
33
+ )
34
+
35
+ examples1=[["Image1.jpg"],["Image2.jpg"],["Image3.jpg"],["Image4.jpg"],["Image5.jpg"],["Image6.jpg"]]
36
+
37
+ Top_Title="<center>Yolov7 🚀 Custom Trained by <a href='https://www.linkedin.com/in/owaiskhan9654/' style='text-decoration: underline' target='_blank'>Owais Ahmad </center></a> on around 140 general items in Stores"
38
+ css = ".output-image, .input-image {height: 50rem !important; width: 100% !important;}"
39
+ css = ".image-preview {height: auto !important;}"
40
+
41
+ gr.Interface(
42
+ fn=object_detection,
43
+ inputs=image,
44
+ outputs=outputs,
45
+ title=Top_Title,
46
+ description=Custom_description,
47
+ article=Footer,
48
+ examples=examples1).launch()
requirements.txt ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #Yolov7 WongKinYiu Requirements
2
+
3
+ # Usage: pip install -r requirements.txt
4
+
5
+ # Base ----------------------------------------
6
+ matplotlib>=3.2.2
7
+ numpy>=1.18.5
8
+ opencv-python>=4.1.1
9
+ Pillow>=7.1.2
10
+ PyYAML>=5.3.1
11
+ requests>=2.23.0
12
+ scipy>=1.4.1
13
+ torch>=1.7.0,!=1.12.0
14
+ torchvision>=0.8.1,!=0.13.0
15
+ tqdm>=4.41.0
16
+ protobuf<4.21.3
17
+
18
+ # Logging -------------------------------------
19
+ tensorboard>=2.4.1
20
+ # wandb
21
+
22
+ # Plotting ------------------------------------
23
+ pandas>=1.1.4
24
+ seaborn>=0.11.0
25
+
26
+ # Export --------------------------------------
27
+ # coremltools>=4.1 # CoreML export
28
+ # onnx>=1.9.0 # ONNX export
29
+ # onnx-simplifier>=0.3.6 # ONNX simplifier
30
+ # scikit-learn==0.19.2 # CoreML quantization
31
+ # tensorflow>=2.4.1 # TFLite export
32
+ # tensorflowjs>=3.9.0 # TF.js export
33
+ # openvino-dev # OpenVINO export
34
+
35
+ # Extras --------------------------------------
36
+ ipython # interactive notebook
37
+ psutil # system utilization
38
+ thop # FLOPs computation