Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dream Hack #26

Open
wants to merge 25 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 81 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,85 @@
# intel-oneAPI

<<<<<<< HEAD
#### Team Name - Dream Hack
#### Problem Statement - Object detection for autonomous vehicles
#### Team Leader Email - [email protected]

## A Brief of the Prototype:
# UML diagram ![image](https://github.com/mansi12340/object_detection_for_autonomous_vehicles_oneAPI/blob/main/images/Flowchart.png)
The project aims towards the detection of two main things that have been the major contributors in the road accidents:
1) object detection= Our project detects the objects in front of the vehicles in a range of 10 metres to 40 metres.
2)pothole detection= Our project detects the potholes in front of the vehicles in the range 5 metres to 6 metres with accuracy.
Other than this, our project can detect the object and vehicles in night and in fog which is the most suitable thing to avoid accidents.
# Components Used ![image](https://github.com/mansi12340/object_detection_for_autonomous_vehicles_oneAPI/blob/main/images/Components.jpg)
## Tech Stack:
List of technologies used both in hardware and software
* Raspberry pi 4 board
* LIDAR sensor pro
* Raspberry pi
* camera night vision
* Raspion os
* numactl
* intel-oneAPI

## Step-by-Step Code Execution Instructions:
Step 1: CLone the repository
```bash
git clone https://github.com/mansi12340/object_detection_for_autonomous_vehicles_oneAPI object_detection && cd object_detection
```

Step 2: Install the required libraries of Intel-openAPI
```bash
# APT Package Manager
sudo apt install intel-aikit
```
For new Users:
Note: oneAPI.sh script does the installation work automatically
```bash
# Set up the repository. To do this, download the key to the system keyring:
wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB \ gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null
# Add the signed entry to APT sources and configure the APT client to use the Intel repository:
echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
# Update the packages list and repository index.
sudo apt update
```
Step 3: Give run.sh execution permissions
```bash
chmod +x bash.sh
```
Step 4: Execute run.sh
```bash
./run.sh
```

## What I Learned:
1) We learnt to interface the raspberry pi cam with the raspberry pi board.
2) How to create a model using intel one API toolkit.
3) How to detect the potholes and other objects using tensorflow embedding in raspberry pi cam.
4) How to use LIDAR sensor for the detction of objects

Numactl is a standalone command-line utility that is part of the Linux operating system. It provides a set of commands to control memory allocation and process placement on NUMA systems.

However, you can use Numactl in conjunction with Intel oneAPI to optimize memory access and resource allocation for applications developed using the oneAPI programming model. Here's how you can integrate them:

Application Design: When designing your application with the oneAPI programming model, you can consider the NUMA architecture and memory layout. By understanding the NUMA topology of your system, you can strategically allocate and access memory to minimize latency and improve performance.

Command Invocation: You can invoke Numactl commands within your application code or in the execution environment to set memory placement and process/thread affinity. For example, you can use system calls or execute shell commands from your application to invoke Numactl with the desired options.

Resource Management: Intel oneAPI provides libraries and tools to manage resources and optimize performance for specific hardware architectures, such as CPUs, GPUs, and FPGAs. While Numactl focuses on NUMA-specific memory and process management, oneAPI tools can handle other aspects of resource management, such as task scheduling, workload distribution, and hardware-specific optimizations.

## Highlights
* video 1
```mp4
https://www.youtube.com/watch?v=Kj6hxT09CPg
```
[<img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTOPNC8IVVkBB_5_yGlAtuFSZZt4R_NujjIOg&usqp=CAU" width="50%">](https://www.youtube.com/watch?v=Kj6hxT09CPg "Now in Android: 55")
* video 2
```mp4
https://www.youtube.com/watch?v=s-9vVI95zn8
```
[<img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTOPNC8IVVkBB_5_yGlAtuFSZZt4R_NujjIOg&usqp=CAU" width="50%">](https://www.youtube.com/watch?v=s-9vVI95zn8 "Now in Android: 55")
=======
#### Team Name -
#### Problem Statement -
#### Team Leader Email -
Expand All @@ -15,3 +95,4 @@

## What I Learned:
Write about the biggest learning you had while developing the prototype
>>>>>>> origin/main
Binary file added images/Components.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added images/Flowchart.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
48 changes: 48 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import cv2
from ultralyticsplus import YOLO, render_result

# load model
model = YOLO('keremberke/yolov8n-pothole-segmentation')

# set model parameters
model.overrides['conf'] = 0.25 # NMS confidence threshold
model.overrides['iou'] = 0.45 # NMS IoU threshold
model.overrides['agnostic_nms'] = False # NMS class-agnostic
model.overrides['max_det'] = 1000 # maximum number of detections per image

# Open the default camera
cap = cv2.VideoCapture(0)

# Check if the camera is opened successfully
if not cap.isOpened():
print("Failed to open the camera")
exit()

while True:
# Read frame from the camera
ret, frame = cap.read()

# Check if the frame is read successfully
if not ret:
print("Failed to capture frame")
break

# # Convert the frame to grayscale
# gray_frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGBA)

# perform inference
results = model.predict(frame)
# observe results
print(results[0])
# time.sleep(0.5)

# Display the grayscale frame
cv2.imshow("Grayscale Frame", frame)

# Exit if 'q' is pressed
if cv2.waitKey(1) == ord('q'):
break

# Release the camera and close windows
cap.release()
cv2.destroyAllWindows()
20 changes: 20 additions & 0 deletions oneAPI_Setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

# Prerequisites for First-Time Users

# Set up the repository. To do this, download the key to the system keyring:
wget -O- https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS.PUB \ gpg --dearmor | sudo tee /usr/share/keyrings/oneapi-archive-keyring.gpg > /dev/null
# Add the signed entry to APT sources and configure the APT client to use the Intel repository:
echo "deb [signed-by=/usr/share/keyrings/oneapi-archive-keyring.gpg] https://apt.repos.intel.com/oneapi all main" | sudo tee /etc/apt/sources.list.d/oneAPI.list
# Update the packages list and repository index.
sudo apt update







# APT Package Manager
sudo apt install intel-aikit
# Intel® AI Analytics Toolkit (version 2023.1.1) has been updated to include functional and security updates. Users should update to the latest version as it becomes available.
Binary file not shown.
3 changes: 3 additions & 0 deletions run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

numactl --cpunodebind=0 --membind=0 python ./main.py