|
| 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 | + |
| 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