Skip to content

Commit 5c0a9dd

Browse files
author
davidoracle-wq
committed
demo: vision stream analysis
1 parent bdfb2e1 commit 5c0a9dd

File tree

8 files changed

+782
-0
lines changed

8 files changed

+782
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
Copyright (c) 2025 Oracle and/or its affiliates.
2+
3+
The Universal Permissive License (UPL), Version 1.0
4+
5+
Subject to the condition set forth below, permission is hereby granted to any
6+
person obtaining a copy of this software, associated documentation and/or data
7+
(collectively the "Software"), free of charge and under any and all copyright
8+
rights in the Software, and any and all patent rights owned or freely
9+
licensable by each licensor hereunder covering either (i) the unmodified
10+
Software as contributed to or provided by such licensor, or (ii) the Larger
11+
Works (as defined below), to deal in both
12+
13+
(a) the Software, and
14+
(b) any piece of software and/or hardware listed in the lrgrwrks.txt file if
15+
one is included with the Software (each a "Larger Work" to which the Software
16+
is contributed by such licensors),
17+
18+
without restriction, including without limitation the rights to copy, create
19+
derivative works of, display, perform, and distribute the Software and make,
20+
use, sell, offer for sale, import, export, have made, and have sold the
21+
Software and the Larger Work(s), and to sublicense the foregoing rights on
22+
either these or other terms.
23+
24+
This license is subject to the following condition:
25+
The above copyright notice and either this complete permission notice or at
26+
a minimum a reference to the UPL must be included in all copies or
27+
substantial portions of the Software.
28+
29+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
30+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
31+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
32+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
33+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
34+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
35+
SOFTWARE.
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# OCI Vision Streaming Setup and Consumption
2+
3+
## Quick Start Guide
4+
5+
## 1. Region Selection
6+
7+
OCI Vision Streaming is available in multiple regions.
8+
9+
- For the **simplest setup**, run your pipeline within the **Ashburn** region.
10+
No subnet or private endpoint creation is required in Ashburn.
11+
12+
- To run in a region other than Ashburn, **[follow these steps](https://docs.oracle.com/en-us/iaas/Content/vision/using/video-stream-processing-top.htm)**.
13+
> _Running in other regions may require additional VCN/Subnet/Endpoint configuration._
14+
15+
---
16+
17+
## 2. Prerequisites
18+
19+
- **An active RTSP stream URL** (e.g., from an IP camera or RTSP streaming source)
20+
- Access to a **Jupyter environment**
21+
- Required permissions in your OCI compartment to use Vision, Stream Jobs, and Object Storage buckets
22+
23+
---
24+
25+
## 3. Setting up the Vision Streaming Job
26+
27+
1. **Open the** `OCIVisionStreamSetup.ipynb` **notebook in Jupyter**.
28+
29+
2. **Fill out the required fields at the top of the notebook:**
30+
31+
- `CONFIG_PROFILE` — OCI CLI profile to use (e.g., `"DEFAULT"`)
32+
- `COMPARTMENT_ID` — your OCI compartment's OCID
33+
- `STREAM_JOB_DISPLAY_NAME` — a display name for your stream job
34+
- `CAMERA_URL` — your RTSP stream URL
35+
- `NAMESPACE` — your Object Storage namespace
36+
- `BUCKET` — target Object Storage bucket
37+
- `PREFIX` — (Optional) Prefix for output files in Object Storage
38+
- `FEATURES` — Detection features (`face`, `object`, etc.)
39+
40+
3. **Run the following notebook cells in order:**
41+
- Create Stream Source
42+
- Create Stream Job
43+
- Run Stream Job
44+
45+
_This will start streaming frames from your camera to OCI Vision for detection (e.g., face or object recognition). The results (bounding box coordinates, frame encodings, etc.) will be stored as JSON files in the specified Object Storage bucket._
46+
47+
---
48+
49+
## 4. Consuming Streams with Streamlit
50+
51+
Install the required dependencies by running
52+
53+
pip install -r requirements.txt
54+
55+
56+
While the stream job is active:
57+
58+
1. **Start the Streamlit app (in terminal):**
59+
```bash
60+
streamlit run streamlit_app.py
61+
2. In the Streamlit UI, enter the following:
62+
- Stream Job OCID
63+
- Bucket Name
64+
- Prefix (Object Storage path, if applicable)
65+
- Object Storage Namespace
66+
- Detection Type: choose between "Object Detection" or "Face Detection"
67+
3. Click on Consume Stream The video with detected objects/faces will appear in your browser as annotated frames.
68+
Note: Frames may appear slow; OCI Vision Streaming currently supports a maximum of 2 frames per second.
69+
- Depending on whether you selected object detection or face detection in the features during the creation of the stream job, select the appropriate radio button to get the relevant analytics.
70+
![UI Screenshot](./media/appUI.png)
71+
72+
73+
## 5. Resource Management — Important!
74+
Stop the Stream Job when finished!
75+
Leaving it running will keep streaming data into your bucket, leading to large storage consumption.
76+
Clean up resources:
77+
Use the notebook cells to delete the Stream Job and Stream Source.
78+
Optionally, store the OCIDs of created resources and reuse them to avoid recreating each time.
79+
80+
81+
## 6. References
82+
- [OCI Vision Stream Analysis Documentation](https://docs.oracle.com/en-us/iaas/Content/vision/using/video-stream-processing-top.htm)
83+
- [OCI Python SDK API Reference](https://docs.oracle.com/en-us/iaas/tools/python/2.162.0/api/landing.html)
84+
85+
## 7. Troubleshooting
86+
**Common Errors:
87+
If you encounter a 405 – Request Not Allowed error while running the stream job, it may be because the job is currently transitioning between states (for example, from CREATED to RUNNING). During this UPDATING phase, the job is temporarily locked, and you won’t be able to perform any actions on it. If it remains stuck in this state, try deleting the stream job and creating a new one.
88+
89+
## 8. License
90+
Copyright (c) 2025 Oracle and/or its affiliates.
91+
Licensed under the Universal Permissive License (UPL), Version 1.0.
92+
See [License](https://github.com/facebookresearch/sam2/blob/main/LICENSE) for more details.

0 commit comments

Comments
 (0)