ioannismihailidis / venvBuilderTD

14 stars 3 forks source link

integrating cusom models #1

Open delray opened 6 days ago

delray commented 6 days ago

Hi, this is a great tool - I've got it working here on my end with the supplied detection/segmentation models, but now I am trying to adapt it to a custom pose classification model for a project I'm working on. The model and the python code work from a terminal, but integrating into your framework is a bit tricky. Not sure where its best to ask questions - here or the TD forum?

ioannismihailidis commented 6 days ago

Hi @delray, thanks for using this tiny project. Is it a custom yolo model or based on another model?

delray commented 6 days ago

well its a fine tuned yolov8 model, so I assumed it would work, but the TD integration is new for me. The code I'm using is here: [https://github.com/delray/PoseClassifier-yolo]

ioannismihailidis commented 6 days ago

You can modify the example "YoloV8Detection" quite easy. Make sure that its running with issues.

First add you custom model (.pt file has to be in your project folder) to DAT table_yolo__models. image

This will allow you to select you custom model in the parameters: image

Enable/Disable the tox will load your custom model.

Passing a new image to a inference function is already provided with the TOP on cook function: image

The example inferene function is in "YOLOv8OnnxExt" and shows how to use the model data in various ways and e.g. pass the date to a DAT:

image

THIS is the place where you should place your terminal inference code.

At the moment the code is missing color channel swap because TD and pytorch need different channels orders. You maaay could run into detection errors.

delray commented 6 days ago

yeah, I have that figured out, but i guess Im just trying to wort out the order of things between the cuda top, script and the actual yolo code. I think i'm getting close, just trying to squash errors. The inference and what is returned is quite a bit different for pose classification vs detection.

delray commented 5 days ago

I got it all working here, and then restarted my PC, and reopend the toe file, but I got an odd error upon opening.

Any clues?

Traceback (most recent call last): File "/YoloV8DetectionCudatop/script1_callbacks", line 4 r = previousimport(*args, **kw) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\mb\AppData\Roaming\Python\Python311\site-packages\numpy\__init__.py", line 112 _delvewheel_patch_1_5_2() File "C:\Users\mb\AppData\Roaming\Python\Python311\site-packages\numpy\__init__.py", line 109, in _delvewheel_patch_1_5_2 os.add_dll_directory(libs_dir) File "<frozen os>", line 1119, in add_dll_directory FileNotFoundError: [WinError 206] The filename or extension is too long: 'C:\\Users\\mb\\AppData\\Roaming\\Python\\Python311\\site-packages\\numpy.libs'