# Use Your AI Model and Video You can use your own model and run it with the sample applications provided. You can also bring your own video file source. This article will show you how to do it. > [!IMPORTANT] > If you have previously run the setup for the sample app using `setup.sh`, > the default sample model and video are downloaded under `resource/` in your repo. > You can manually add your files next to them. > > For compose-based deployment, the entire resources directory is volume mounted and made > available to pipeline server. ## File Location The model and the input video file are placed in the `resources//` folder, under the `model` and `video` directories: ::::{tab-set} :::{tab-item} **Pallet Defect Detection** :sync: pallet-detect ```text - resources/ - pallet-defect-detection/ - models/ - pallet_defect_detection/ - deployment/ - Detection/ - model/ - model.bin - model.xml - videos/ - warehouse.avi ``` ::: :::{tab-item} **PCB Anomaly Detection** :sync: pcb-detect ```text - resources/ - pcb-anomaly-detection/ - models/ - pcb-anomaly-detection/ - deployment/ - Anomaly classification/ - model/ - model.bin - model.xml - videos/ - anomalib_pcb_test.avi ``` ::: :::: > [!NOTE] > You can customize the directory structure for different resources and use cases. ## Docker compose deployment 1. The `resources` folder containing both the model and video file is a volume mounted into DL Streamer Pipeline Server in `docker-compose.yml` (included in the repository), like so: ```text volumes: - ./resources/${SAMPLE_APP}/:/home/pipeline-server/resources/ ``` > [!NOTE] > The value of `${SAMPLE_APP}` is fetched from the `.env` file specifying the > particular sample app you are running. 2. Make sure to adjust the pipeline to the model you are using. See the `pipeline-server-config.json` included in the repository. - for a **detection model**, use `gvadetect` - as used in the `pallet_defect_detection` pipeline. - for a **classification model**, use `gvaclassify` - as used in the `pcb_anomaly_detection` pipeline. 3. The `pipeline-server-config.json` is a volume mounted into DL Streamer Pipeline Server in `docker-compose.yml` (included in the repository), like so: ```text volumes: - ${APP_DIR}/configs/pipeline-server-config.json:/home/pipeline-server/config.json ``` 4. Provide the model path and video file path in the REST/curl command to start an inference workload. For example: > [!NOTE] > If you are running multiple instances of the application, make sure to provide > `NGINX_HTTPS_PORT` number in the URL for the application instance, i.e., replace `` with > `:` > > If you are running a single instance and using an `NGINX_HTTPS_PORT` other than the > default 443, replace `` with `:`. ::::{tab-set} :::{tab-item} **Pallet Defect Detection** :sync: pallet-detect ```sh curl -k https:///api/pipelines/user_defined_pipelines/pallet_defect_detection -X POST -H 'Content-Type: application/json' -d '{ "source": { "uri": "file:///home/pipeline-server/resources/videos/warehouse.avi", "type": "uri" }, "destination": { "frame": { "type": "webrtc", "peer-id": "samplestream", "overlay-properties": { "font-scale": 1.0, "draw-txt-bg": false } } }, "parameters": { "detection-properties": { "model": "/home/pipeline-server/resources/models/pallet-defect-detection/model.xml", "device": "CPU" } } }' ``` ::: :::{tab-item} **PCB Anomaly Detection** :sync: pcb-detect ```sh curl -k https:///api/pipelines/user_defined_pipelines/pcb_anomaly_detection -X POST -H 'Content-Type: application/json' -d '{ "source": { "uri": "file:///home/pipeline-server/resources/videos/anomalib_pcb_test.avi", "type": "uri" }, "destination": { "frame": { "type": "webrtc", "peer-id": "anomaly", "overlay-properties": { "font-scale": 1.0, "draw-txt-bg": false } } }, "parameters": { "classification-properties": { "model": "/home/pipeline-server/resources/models/pcb-anomaly-detection/deployment/Anomaly classification/model/model.xml", "device": "CPU" } } }' ``` ::: ::::