Sriram Elango commited on
Commit
8c45328
1 Parent(s): 28e7798
.gitignore ADDED
@@ -0,0 +1 @@
 
 
1
+ **/.DS_Store
Content/README.roboflow.txt ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ Anti-Social Classification - v1 Training Data
3
+ ==============================
4
+
5
+ This dataset was exported via roboflow.ai on May 29, 2022 at 11:41 PM GMT
6
+
7
+ It includes 232 images.
8
+ Anti-Social-Imagery are annotated in YOLO v5 PyTorch format.
9
+
10
+ The following pre-processing was applied to each image:
11
+ * Auto-orientation of pixel data (with EXIF-orientation stripping)
12
+ * Resize to 416x416 (Stretch)
13
+
14
+ The following augmentation was applied to create 3 versions of each source image:
15
+ * 50% probability of horizontal flip
16
+
17
+
Content/best.pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ebe736fb49492830593165d94e2543de337d82d7acc592e25f8e1a7b33d846f1
3
+ size 14358133
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,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ names:
2
+ - Confederate Flag
3
+ - Gun
4
+ - KKK Triangle
5
+ - KKK
6
+ - Noose
7
+ - Swastika
8
+ nc: 6
9
+ train: /content/datasets/Anti-Social-Classification-1/train/images
10
+ val: /content/datasets/Anti-Social-Classification-1/valid/images
app.py ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ results.render() # updates results.imgs with boxes and labels
27
+ return Image.fromarray(results.imgs[0])
28
+
29
+
30
+ inp = gr.inputs.Image(type="pil", label="Original Image")
31
+ output = gr.outputs.Image(type="pil", label="Output Image")
32
+
33
+
34
+ io=gr.Interface(fn=detect, inputs=inp, outputs=output, title='CV Social Classification',theme='peach')
35
+ io.launch(debug=True,share=False)
36
+
37
+ #examples=['Content/4.jpg','Content/10.jpg','Content/18.jpg']
38
+
39
+
40
+
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
+