Khadas Docs

Amazing Khadas, always amazes you!

User Tools

Site Tools


products:sbc:vim4:npu:demos:yolov8n

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
products:sbc:vim4:npu:demos:yolov8n [2023/09/18 00:32]
sravan [Compile and run]
products:sbc:vim4:npu:demos:yolov8n [2024/02/17 22:43] (current)
louis
Line 18: Line 18:
 ==== Build virtual environment ==== ==== Build virtual environment ====
  
-Follow Docker official docs to install Docker: [[https://docs.docker.com/engine/install/ubuntu/|Install Docker Engine on Ubuntu]].+Follow Docker official documentation to install Docker: [[https://docs.docker.com/engine/install/ubuntu/|Install Docker Engine on Ubuntu]].
  
-Get Docker.+Then fetch the prebuilt NPU Docker container and run it.
  
 ```shell ```shell
Line 42: Line 42:
 After training model, modify ''ultralytics/ultralytics/nn/modules/head.py'' as follows. After training model, modify ''ultralytics/ultralytics/nn/modules/head.py'' as follows.
  
-```diff ultralytics/nn/modules/head.py.patch+```diff head.py
 diff --git a/ultralytics/nn/modules/head.py b/ultralytics/nn/modules/head.py diff --git a/ultralytics/nn/modules/head.py b/ultralytics/nn/modules/head.py
 index 0b02eb3..0a6e43a 100644 index 0b02eb3..0a6e43a 100644
Line 66: Line 66:
 +            dfl = self.cv2[i](x[i]).contiguous() +            dfl = self.cv2[i](x[i]).contiguous()
 +            cls = self.cv3[i](x[i]).contiguous() +            cls = self.cv3[i](x[i]).contiguous()
-+            results.append(torch.cat([cls, dfl], 1).permute(0, 2, 3, 1).unsqueeze(1))++            results.append(torch.cat([cls, dfl], 1).permute(0, 2, 3, 1))
 +            # results.append(torch.cat([cls, dfl], 1)) +            # results.append(torch.cat([cls, dfl], 1))
 +        return tuple(results) +        return tuple(results)
 + +
 ``` ```
 +
 +<WRAP important>
 +If you pip-installed ultralytics package, you should modify in package.
 +</WRAP>
  
 Create a python file written as follows to export ONNX model. Create a python file written as follows to export ONNX model.
Line 83: Line 87:
 $ python export.py $ python export.py
 ``` ```
 +
 +<WRAP important>
 +Use [[https://netron.app/ | Netron]] to check your model output like this. If not, please check your ''head.py''.
 +
 +{{:products:sbc:vim4:npu:demos:yolov8n-vim4-output.png?600|}}
 +</WRAP>
  
 Enter ''vim4_npu_sdk/demo'' and modify ''convert_adla.sh'' as follows. Enter ''vim4_npu_sdk/demo'' and modify ''convert_adla.sh'' as follows.
Last modified: 2023/09/18 00:32 by sravan