Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,14 +10,14 @@ import tempfile
|
|
| 10 |
import os
|
| 11 |
|
| 12 |
# Set page config
|
| 13 |
-
st.set_page_config(page_title="
|
| 14 |
|
| 15 |
def load_model():
|
| 16 |
"""Load the YOLO model"""
|
| 17 |
model = AutoDetectionModel.from_pretrained(
|
| 18 |
model_type='yolov8',
|
| 19 |
model_path='yolov10x.pt',
|
| 20 |
-
confidence_threshold=0.
|
| 21 |
device="cuda" if torch.cuda.is_available() else "cpu"
|
| 22 |
)
|
| 23 |
return model
|
|
@@ -33,8 +33,8 @@ def process_image(image_path, model):
|
|
| 33 |
model,
|
| 34 |
slice_height=512,
|
| 35 |
slice_width=512,
|
| 36 |
-
overlap_height_ratio=0.
|
| 37 |
-
overlap_width_ratio=0.
|
| 38 |
)
|
| 39 |
|
| 40 |
# Convert PIL image to numpy array
|
|
@@ -72,14 +72,6 @@ def process_image(image_path, model):
|
|
| 72 |
def main():
|
| 73 |
st.title("Object Detection with YOLO and SAHI")
|
| 74 |
|
| 75 |
-
# Add sidebar information
|
| 76 |
-
st.sidebar.header("About")
|
| 77 |
-
st.sidebar.write("""
|
| 78 |
-
This app uses YOLOv8 and SAHI for improved object detection.
|
| 79 |
-
SAHI helps in detecting small objects and handling edge cases by
|
| 80 |
-
slicing the image into smaller pieces.
|
| 81 |
-
""")
|
| 82 |
-
|
| 83 |
# Load model
|
| 84 |
@st.cache_resource
|
| 85 |
def get_model():
|
|
|
|
| 10 |
import os
|
| 11 |
|
| 12 |
# Set page config
|
| 13 |
+
st.set_page_config(page_title="AI Powered Ship Detection using SAR", layout="wide")
|
| 14 |
|
| 15 |
def load_model():
|
| 16 |
"""Load the YOLO model"""
|
| 17 |
model = AutoDetectionModel.from_pretrained(
|
| 18 |
model_type='yolov8',
|
| 19 |
model_path='yolov10x.pt',
|
| 20 |
+
confidence_threshold=0.5,
|
| 21 |
device="cuda" if torch.cuda.is_available() else "cpu"
|
| 22 |
)
|
| 23 |
return model
|
|
|
|
| 33 |
model,
|
| 34 |
slice_height=512,
|
| 35 |
slice_width=512,
|
| 36 |
+
overlap_height_ratio=0.5,
|
| 37 |
+
overlap_width_ratio=0.5
|
| 38 |
)
|
| 39 |
|
| 40 |
# Convert PIL image to numpy array
|
|
|
|
| 72 |
def main():
|
| 73 |
st.title("Object Detection with YOLO and SAHI")
|
| 74 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
# Load model
|
| 76 |
@st.cache_resource
|
| 77 |
def get_model():
|