Skip to content

Commit

Permalink
feat. switch to yolo320
Browse files Browse the repository at this point in the history
  • Loading branch information
Chen-Yulin committed Apr 13, 2024
1 parent 48c692d commit dc81d74
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Assets/Scenes/SampleScene.unity
Original file line number Diff line number Diff line change
Expand Up @@ -10962,7 +10962,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: aad934041a3d88c45b687ed811756753, type: 3}
m_Name:
m_EditorClassIdentifier:
ModelFile: {fileID: 5022602860645237092, guid: 0a133a957381bf448918730d57608d88, type: 3}
ModelFile: {fileID: 5022602860645237092, guid: 191bc89fbc388ae4c9f0b290bd0a7776, type: 3}
material_t: {fileID: 2100000, guid: d4c3396def303a84d81ff6a10a617c11, type: 2}
MinBoxConfidence: 0.3
textureProviderType: 0
Expand Down
2 changes: 2 additions & 0 deletions Assets/Script/Detection/NN/YOLOv8.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public List<ResultBox> Run(Texture2D image)
Profiler.BeginSample("YOLO.Run");
var outputs = ExecuteModel(image);
var results = Postprocess(outputs);
//var results = new List<ResultBox>();
Profiler.EndSample();
return results;
}
Expand All @@ -44,6 +45,7 @@ private void ExecuteBlocking(Tensor preprocessed)
Profiler.EndSample();
}


private IEnumerable<Tensor> PeekOutputs()
{
foreach (string outputName in nn.model.outputs)
Expand Down
6 changes: 3 additions & 3 deletions Assets/Script/Detection/NN/YOLOv8OutputReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ public class YOLOv8OutputReader
{
public static float DiscardThreshold = 0.1f;
protected const int ClassesNum = 80;
const int BoxesPerCell = 8400;
const int InputWidth = 640;
const int InputHeight = 640;
const int BoxesPerCell = 2100;
const int InputWidth = 320;
const int InputHeight = 320;

public IEnumerable<ResultBox> ReadOutput(Tensor output)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public TextureProvider(int width, int height, TextureFormat format = TextureForm

public virtual Texture2D GetTexture()
{
return TextureTools.ResizeAndCropToCenter(InputTexture, ref ResultTexture, ResultTexture.width, ResultTexture.height);
return TextureTools.ResizeAndCropToCenter(InputTexture, ref ResultTexture, 640, 640);
}

public abstract TextureProviderType.ProviderType TypeEnum();
Expand Down
2 changes: 1 addition & 1 deletion Assets/XR/Settings/OpenXR Package Settings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 9f34c86d1a130cc45a438373e1e8a4fc, type: 3}
m_Name: PlayModeRemotingPlugin Standalone
m_EditorClassIdentifier:
m_enabled: 0
m_enabled: 1
nameUi: Holographic Remoting for Play Mode
version: 1.8.1
featureIdInternal: com.microsoft.openxr.feature.playmoderemoting
Expand Down
Binary file added Assets/yolov8n_320 1.onnx
Binary file not shown.
16 changes: 16 additions & 0 deletions Assets/yolov8n_320 1.onnx.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit dc81d74

Please sign in to comment.