Sriram Elango commited on
Commit
2742b84
1 Parent(s): 5efe86c

Add Everything

Browse files
.gitignore ADDED
@@ -0,0 +1 @@
 
 
1
+ **/.DS_Store
Content/best.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1c27003e4c2b43494a3c2384114794a925eb7f39389c2966af3c207f1f2eb06e
3
+ size 14347189
Content/configurations.md ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ model.conf = 0.25 # NMS confidence threshold
2
+ iou = 0.45 # NMS IoU threshold
3
+ agnostic = False # NMS class-agnostic
4
+ multi_label = False # NMS multiple labels per box
5
+ classes = None # (optional list) filter by class, i.e. = [0, 15, 16] for COCO persons, cats and dogs
6
+ max_det = 1000 # maximum number of detections per image
7
+ amp = False # Automatic Mixed Precision (AMP) inference
Content/data.yaml ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ names:
2
+ - Airplane
3
+ - Ship
4
+ - Tree
5
+ - Vehicle
6
+ nc: 4
7
+ train: /content/datasets/Palmyra-Classification-1/train/images
8
+ val: /content/datasets/Palmyra-Classification-1/valid/images
app.py ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import os
3
+ import torch
4
+ from PIL import Image
5
+
6
+
7
+ #subprocess.run(["mv","content/custom_data.yaml","./yolov5/data"])
8
+
9
+
10
+ def load_model():
11
+ '''
12
+ Loading hub model & setting the preferences for the model
13
+ '''
14
+ model = torch.hub.load('ultralytics/yolov5', 'custom', path='Content/best.pt')
15
+ model.conf = 0.38
16
+ model.dnn=True
17
+ model.agnostic=True
18
+ return model
19
+
20
+ model=load_model()
21
+ #, force_reload=True
22
+ def detect(inp):
23
+ #g = (size / max(inp.size)) #gain
24
+ #im = im.resize((int(x * g) for x in im.size), Image.ANTIALIAS) # resize
25
+ results = model(inp,size=640) # inference
26
+ print(results)
27
+ results.render() # updates results.imgs with boxes and labels
28
+ return Image.fromarray(results.imgs[0])
29
+
30
+
31
+ inp = gr.inputs.Image(type="pil", label="Original Image")
32
+ output = gr.outputs.Image(type="pil", label="Output Image")
33
+
34
+
35
+ io=gr.Interface(fn=detect, inputs=inp, outputs=output, title='A3 Satellite Classification',theme='peach')
36
+ io.launch(debug=True,share=False)
37
+
38
+ #examples=['Content/4.jpg','Content/10.jpg','Content/18.jpg']
39
+
40
+
41
+
packages.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ libgl1-mesa-glx
requirements.txt ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ gradio
2
+
3
+ # Base ----------------------------------------
4
+ matplotlib>=3.2.2
5
+ numpy>=1.18.5
6
+ opencv-python>=4.1.2
7
+ Pillow>=7.1.2
8
+ PyYAML>=5.3.1
9
+ requests>=2.23.0
10
+ scipy>=1.4.1
11
+ torch>=1.7.0
12
+ torchvision>=0.8.1
13
+ tqdm>=4.41.0
14
+
15
+
16
+
17
+ # Plotting ------------------------------------
18
+ pandas>=1.1.4
19
+ seaborn>=0.11.0
20
+