Skip to content
Merged
4 changes: 2 additions & 2 deletions .github/actions/common/license-namespace-checker/run.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
# ==============================================================================
# Copyright (C) 2025 Intel Corporation
# Copyright (C) 2025-2026 Intel Corporation
#
# SPDX-License-Identifier: MIT
# ==============================================================================
Expand All @@ -14,7 +14,7 @@ SCRIPT_DIR=$(dirname "$(readlink -f "$0")")

if [ -z "${SOURCE_DIR}" ]; then
echo "ERROR: Path to source dir should be provided!"
exit -1
exit 1
fi

git config --global --add safe.directory "${SOURCE_DIR}"
Expand Down
42 changes: 30 additions & 12 deletions .github/actions/common/shellcheck/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ runs:

- name: Analyze ShellCheck results
if: always()
id: analyze-results
env:
output_file: ${{ inputs.output-file }}
name: ${{ inputs.name }}
Expand All @@ -54,18 +55,25 @@ runs:
warning_count=$(grep -E "SC[0-9]+ \(warning\):" "${output_file}" 2>/dev/null | wc -l | tr -d '[:space:]' || echo "0")
info_count=$(grep -E "SC[0-9]+ \(info\):" "${output_file}" 2>/dev/null | wc -l | tr -d '[:space:]' || echo "0")
note_count=$(grep -E "SC[0-9]+ \(note\):" "${output_file}" 2>/dev/null | wc -l | tr -d '[:space:]' || echo "0")

# Ensure counts are valid integers, default to 0 if empty
error_count=${error_count:-0}
warning_count=${warning_count:-0}
info_count=${info_count:-0}
note_count=${note_count:-0}

# Additional safety check - ensure numeric (use case to validate)
case "$error_count" in ''|*[!0-9]*) error_count=0 ;; esac || true
case "$warning_count" in ''|*[!0-9]*) warning_count=0 ;; esac || true
case "$info_count" in ''|*[!0-9]*) info_count=0 ;; esac || true
case "$note_count" in ''|*[!0-9]*) note_count=0 ;; esac || true

total=$((error_count + warning_count + info_count + note_count)) || total=0

# Export error_count for use in the final step
echo "error_count=$error_count" >> $GITHUB_OUTPUT
echo "total_count=$total" >> $GITHUB_OUTPUT

echo "### ShellCheck Results for ${name}" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "- **Total Issues**: $total" >> $GITHUB_STEP_SUMMARY
Expand All @@ -83,13 +91,19 @@ runs:
echo "- 📝 **Notes**: $note_count" >> $GITHUB_STEP_SUMMARY
fi

if [ "$total" -gt 0 ]; then
if [ "$error_count" -gt 0 ]; then
echo "" >> $GITHUB_STEP_SUMMARY
echo "⚠️ **Please review the ShellCheck report artifact and consider fixing the issues.**" >> $GITHUB_STEP_SUMMARY
echo "⚠️ **Please review the ShellCheck report artifact and fix the errors.**" >> $GITHUB_STEP_SUMMARY
else
echo "" >> $GITHUB_STEP_SUMMARY
echo "✅ **No issues found!**" >> $GITHUB_STEP_SUMMARY
echo "✅ **No errors found!**" >> $GITHUB_STEP_SUMMARY
if [ "$total" -gt 0 ]; then
echo "📋 **Note**: There are warnings/info/notes that should be reviewed but won't fail the build." >> $GITHUB_STEP_SUMMARY
fi
fi
else
echo "error_count=0" >> $GITHUB_OUTPUT
echo "total_count=0" >> $GITHUB_OUTPUT
fi
shell: bash

Expand All @@ -104,20 +118,24 @@ runs:
if: ${{ inputs.enable-reviewdog == 'true' }}
uses: reviewdog/action-shellcheck@4c07458293ac342d477251099501a718ae5ef86e # 1.32.0
with:
path: .
github_token: ${{ inputs.github_token }}
reporter: github-pr-review
level: warning

- name: Fail if ShellCheck found issues
- name: Fail if ShellCheck found errors
if: inputs.fail-on-findings == 'true'
shell: bash
env:
output_file: ${{ inputs.output-file }}
run: |
if [ -f "${output_file}" ]; then
issue_count=$(grep -E "SC[0-9]+" "${output_file}" 2>/dev/null | wc -l | tr -d '[:space:]' || echo "0")
if [ "$issue_count" -gt 0 ]; then
echo "❌ ShellCheck found $issue_count issue(s). Failing the job."
exit 1
fi
error_count="${{ steps.analyze-results.outputs.error_count }}"
total_count="${{ steps.analyze-results.outputs.total_count }}"

if [ "$error_count" -gt 0 ]; then
echo "❌ ShellCheck found $error_count error(s). Failing the job."
exit 1
elif [ "$total_count" -gt 0 ]; then
echo "✅ ShellCheck found $total_count issue(s) but no errors. Job will continue."
echo "📋 Issues found: warnings, info, or notes that should be reviewed."
else
echo "✅ No ShellCheck issues found."
fi
9 changes: 2 additions & 7 deletions .github/workflows/dls-pr-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -271,23 +271,18 @@ jobs:
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 #5.0.0
with:
persist-credentials: false
path: dlstreamer-repo
fetch-depth: 0

- name: Run shellcheck
uses: ./dlstreamer-repo/.github/actions/common/shellcheck
uses: ./.github/actions/common/shellcheck
with:
path: dlstreamer-repo
path: .
output-file: shellcheck-report.txt
name: DLS_shellcheck
enable-reviewdog: true
github_token: ${{ secrets.GITHUB_TOKEN }}
fail-on-findings: true

- name: Clean up
run: |
sudo rm -rf dlstreamer-repo

dls-yamllint:
permissions:
contents: read
Expand Down
50 changes: 33 additions & 17 deletions samples/download_public_models.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
# ==============================================================================
# Copyright (C) 2021-2025 Intel Corporation
# Copyright (C) 2021-2026 Intel Corporation
#
# SPDX-License-Identifier: MIT
# ==============================================================================
Expand Down Expand Up @@ -155,7 +155,7 @@ prepare_models_list() {
for model in "${models_array[@]}"; do
model=$(echo "$model" | xargs) # Trim whitespace

if ! [[ " ${SUPPORTED_MODELS[*]} " =~ " $model " ]]; then
if ! [[ " ${SUPPORTED_MODELS[*]} " =~ $model ]]; then
echo "Unsupported model: $model" >&2
exit 1
fi
Expand All @@ -164,12 +164,25 @@ prepare_models_list() {
echo "${models_array[@]}"
}

# Function to check if array contains element
array_contains() {
local element="$1"
shift
local array=("$@")
for item in "${array[@]}"; do
if [[ "$item" == "$element" ]]; then
return 0
fi
done
return 1
}

# Trap errors and call handle_error
trap 'handle_error "- line $LINENO"' ERR

# Prepare models list
MODELS_TO_PROCESS=($(prepare_models_list "$MODEL"))
echo "Models to process: ${MODELS_TO_PROCESS[@]}"
mapfile -t MODELS_TO_PROCESS < <(prepare_models_list "$MODEL")
echo "Models to process: ${MODELS_TO_PROCESS[*]}"

if ! [[ "${!SUPPORTED_QUANTIZATION_DATASETS[*]}" =~ $QUANTIZE ]]; then
echo "Unsupported quantization dataset: $QUANTIZE" >&2
Expand Down Expand Up @@ -381,7 +394,8 @@ EOF
}

# check if model exists in local directory, download as needed
if [[ " ${MODELS_TO_PROCESS[@]} " =~ " yolox-tiny " ]] || [[ " ${MODELS_TO_PROCESS[@]} " =~ " yolo_all " ]] || [[ " ${MODELS_TO_PROCESS[@]} " =~ " all " ]]; then MODEL_NAME="yolox-tiny"
if array_contains "yolox-tiny" "${MODELS_TO_PROCESS[@]}" || array_contains "yolo_all" "${MODELS_TO_PROCESS[@]}" || array_contains "all" "${MODELS_TO_PROCESS[@]}"; then
MODEL_NAME="yolox-tiny"
MODEL_DIR="$MODELS_PATH/public/$MODEL_NAME"
DST_FILE1="$MODEL_DIR/FP16/$MODEL_NAME.xml"
DST_FILE2="$MODEL_DIR/FP32/$MODEL_NAME.xml"
Expand All @@ -401,7 +415,8 @@ if [[ " ${MODELS_TO_PROCESS[@]} " =~ " yolox-tiny " ]] || [[ " ${MODELS_TO_PROCE
fi
fi

if [[ " ${MODELS_TO_PROCESS[@]} " =~ " yolox_s " ]] || [[ " ${MODELS_TO_PROCESS[@]} " =~ " yolo_all " ]] || [[ " ${MODELS_TO_PROCESS[@]} " =~ " all " ]]; then MODEL_NAME="yolox_s"
if array_contains "yolox_s" "${MODELS_TO_PROCESS[@]}" || array_contains "yolo_all" "${MODELS_TO_PROCESS[@]}" || array_contains "all" "${MODELS_TO_PROCESS[@]}"; then
MODEL_NAME="yolox_s"
MODEL_DIR="$MODELS_PATH/public/$MODEL_NAME"
DST_FILE1="$MODEL_DIR/FP16/$MODEL_NAME.xml"
DST_FILE2="$MODEL_DIR/FP32/$MODEL_NAME.xml"
Expand Down Expand Up @@ -490,7 +505,7 @@ EOF
YOLOv5u_MODELS=("yolov5nu" "yolov5su" "yolov5mu" "yolov5lu" "yolov5xu" "yolov5n6u" "yolov5s6u" "yolov5m6u" "yolov5l6u" "yolov5x6u")

for MODEL_NAME in "${YOLOv5u_MODELS[@]}"; do
if [[ " ${MODELS_TO_PROCESS[@]} " =~ " $MODEL_NAME " ]] || [[ " ${MODELS_TO_PROCESS[@]} " =~ " yolo_all " ]] || [[ " ${MODELS_TO_PROCESS[@]} " =~ " all " ]]; then
if array_contains "$MODEL_NAME" "${MODELS_TO_PROCESS[@]}" || array_contains "yolo_all" "${MODELS_TO_PROCESS[@]}" || array_contains "all" "${MODELS_TO_PROCESS[@]}"; then
export_yolov5_model "$MODEL_NAME"
fi
done
Expand All @@ -501,7 +516,7 @@ YOLOv5_MODELS=("yolov5n" "yolov5s" "yolov5m" "yolov5l" "yolov5x" "yolov5n6" "yol
# Check if the model is in the list
MODEL_IN_LISTv5=false
for MODEL_NAME in "${YOLOv5_MODELS[@]}"; do
if [[ " ${MODELS_TO_PROCESS[@]} " =~ " $MODEL_NAME " ]] || [[ " ${MODELS_TO_PROCESS[@]} " =~ " yolo_all " ]] || [[ " ${MODELS_TO_PROCESS[@]} " =~ " all " ]]; then
if array_contains "$MODEL_NAME" "${MODELS_TO_PROCESS[@]}" || array_contains "yolo_all" "${MODELS_TO_PROCESS[@]}" || array_contains "all" "${MODELS_TO_PROCESS[@]}"; then
MODEL_IN_LISTv5=true
break
fi
Expand All @@ -516,7 +531,7 @@ if [ "$MODEL_IN_LISTv5" = true ] && [ ! -d "$REPO_DIR" ]; then
fi

for MODEL_NAME in "${YOLOv5_MODELS[@]}"; do
if [[ " ${MODELS_TO_PROCESS[@]} " =~ " $MODEL_NAME " ]] || [[ " ${MODELS_TO_PROCESS[@]} " =~ " yolo_all " ]] || [[ " ${MODELS_TO_PROCESS[@]} " =~ " all " ]]; then
if array_contains "$MODEL_NAME" "${MODELS_TO_PROCESS[@]}" || array_contains "yolo_all" "${MODELS_TO_PROCESS[@]}" || array_contains "all" "${MODELS_TO_PROCESS[@]}"; then
MODEL_DIR="$MODELS_PATH/public/$MODEL_NAME"
if [ ! -d "$MODEL_DIR" ]; then
echo "Downloading and converting: ${MODEL_DIR}"
Expand Down Expand Up @@ -578,7 +593,8 @@ fi


# -------------- YOLOv7 FP32 & FP16
if [[ " ${MODELS_TO_PROCESS[@]} " =~ " yolov7 " ]] || [[ " ${MODELS_TO_PROCESS[@]} " =~ " yolo_all " ]] || [[ " ${MODELS_TO_PROCESS[@]} " =~ " all " ]]; then MODEL_NAME="yolov7"
if array_contains "yolov7" "${MODELS_TO_PROCESS[@]}" || array_contains "yolo_all" "${MODELS_TO_PROCESS[@]}" || array_contains "all" "${MODELS_TO_PROCESS[@]}"; then
MODEL_NAME="yolov7"
MODEL_DIR="$MODELS_PATH/public/$MODEL_NAME"
DST_FILE1="$MODEL_DIR/FP16/$MODEL_NAME.xml"
DST_FILE2="$MODEL_DIR/FP32/$MODEL_NAME.xml"
Expand Down Expand Up @@ -719,7 +735,7 @@ YOLO_MODELS=(

# Iterate over the models and export them
for MODEL_NAME in "${!YOLO_MODELS[@]}"; do
if [[ " ${MODELS_TO_PROCESS[@]} " =~ " $MODEL_NAME " ]] || [[ " ${MODELS_TO_PROCESS[@]} " =~ " yolo_all " ]] || [[ " ${MODELS_TO_PROCESS[@]} " =~ " all " ]]; then
if array_contains "$MODEL_NAME" "${MODELS_TO_PROCESS[@]}" || array_contains "yolo_all" "${MODELS_TO_PROCESS[@]}" || array_contains "all" "${MODELS_TO_PROCESS[@]}"; then
MODEL_NAME_UPPER=$(echo "$MODEL_NAME" | tr '[:lower:]' '[:upper:]')
if [[ $MODEL_NAME_UPPER == *"OBB"* || $MODEL_NAME_UPPER == *"POSE"* || $MODEL_NAME_UPPER == *"SEG"* ]]; then
export_yolo_model "$MODEL_NAME" "${YOLO_MODELS[$MODEL_NAME]}" ""
Expand All @@ -730,7 +746,7 @@ for MODEL_NAME in "${!YOLO_MODELS[@]}"; do
done


if [[ " ${MODELS_TO_PROCESS[@]} " =~ " yolov8_license_plate_detector " ]] || [[ " ${MODELS_TO_PROCESS[@]} " =~ " all " ]]; then
if array_contains "yolov8_license_plate_detector" "${MODELS_TO_PROCESS[@]}" || array_contains "all" "${MODELS_TO_PROCESS[@]}"; then
MODEL_NAME="yolov8_license_plate_detector"
MODEL_DIR="$MODELS_PATH/public/$MODEL_NAME"
DST_FILE1="$MODEL_DIR/FP32/$MODEL_NAME.xml"
Expand Down Expand Up @@ -760,7 +776,7 @@ os.remove('${MODEL_NAME}.zip')
fi
fi

if [[ " ${MODELS_TO_PROCESS[@]} " =~ " centerface " ]] || [[ " ${MODELS_TO_PROCESS[@]} " =~ " all " ]]; then
if array_contains "centerface" "${MODELS_TO_PROCESS[@]}" || array_contains "all" "${MODELS_TO_PROCESS[@]}"; then
MODEL_NAME="centerface"
MODEL_DIR="$MODELS_PATH/public/$MODEL_NAME"
DST_FILE1="$MODEL_DIR/FP16/$MODEL_NAME.xml"
Expand Down Expand Up @@ -807,7 +823,7 @@ EOF
fi

#enet_b0_8_va_mtl
if [[ " ${MODELS_TO_PROCESS[@]} " =~ " hsemotion " ]] || [[ " ${MODELS_TO_PROCESS[@]} " =~ " all " ]]; then
if array_contains "hsemotion" "${MODELS_TO_PROCESS[@]}" || array_contains "all" "${MODELS_TO_PROCESS[@]}"; then
MODEL_NAME="hsemotion"
MODEL_DIR="$MODELS_PATH/public/$MODEL_NAME"
DST_FILE="$MODEL_DIR/FP16/$MODEL_NAME.xml"
Expand Down Expand Up @@ -910,7 +926,7 @@ EOF
fi
done

if [[ " ${MODELS_TO_PROCESS[@]} " =~ " deeplabv3 " ]] || [[ " ${MODELS_TO_PROCESS[@]} " =~ " all " ]]; then
if array_contains "deeplabv3" "${MODELS_TO_PROCESS[@]}" || array_contains "all" "${MODELS_TO_PROCESS[@]}"; then
MODEL_NAME="deeplabv3"
MODEL_DIR="$MODELS_PATH/public/$MODEL_NAME"
DST_FILE1="$MODEL_DIR/FP32/$MODEL_NAME.xml"
Expand Down Expand Up @@ -949,7 +965,7 @@ EOF
fi

# PaddlePaddle OCRv4 multilingual model
if [[ " ${MODELS_TO_PROCESS[@]} " =~ " ch_PP-OCRv4_rec_infer " ]] || [[ " ${MODELS_TO_PROCESS[@]} " =~ " all " ]]; then
if array_contains "ch_PP-OCRv4_rec_infer" "${MODELS_TO_PROCESS[@]}" || array_contains "all" "${MODELS_TO_PROCESS[@]}"; then
MODEL_NAME="ch_PP-OCRv4_rec_infer"
MODEL_DIR="$MODELS_PATH/public/$MODEL_NAME"
DST_FILE1="$MODEL_DIR/FP16/$MODEL_NAME.xml"
Expand Down Expand Up @@ -980,7 +996,7 @@ os.remove('${MODEL_NAME}.zip')
fi

# Mars-Small128 DeepSORT Person Re-ID Model
if [[ " ${MODELS_TO_PROCESS[@]} " =~ " mars-small128 " ]] || [[ " ${MODELS_TO_PROCESS[@]} " =~ " all " ]]; then
if array_contains "mars-small128" "${MODELS_TO_PROCESS[@]}" || array_contains "all" "${MODELS_TO_PROCESS[@]}"; then
MODEL_NAME="mars-small128"
MODEL_DIR="$MODELS_PATH/public/$MODEL_NAME"

Expand Down
4 changes: 2 additions & 2 deletions scripts/DLS_install_prerequisites.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash
# ==============================================================================
# Copyright (C) 2024-2025 Intel Corporation
# Copyright (C) 2024-2026 Intel Corporation
#
# SPDX-License-Identifier: MIT
# ==============================================================================
Expand Down Expand Up @@ -532,7 +532,7 @@ setup_npu() {
install_npu() {
local ubuntu_version="${1:-$(lsb_release -rs)}"
$SUDO_PREFIX rm -rf ./npu_debs
mkdir -p ./npu_debs && cd npu_debs
mkdir -p ./npu_debs && cd npu_debs || exit
dpkg --purge --force-remove-reinstreq intel-driver-compiler-npu intel-fw-npu intel-level-zero-npu
if [ "$ubuntu_version" == "22.04" ]; then
wget https://github.com/oneapi-src/level-zero/releases/download/v1.22.4/level-zero_1.22.4+u22.04_amd64.deb
Expand Down