Development of Machine Learning application addons

I believe there will be more addons in the future that apply machine learning.
However, using machine learning frameworks such as PyTorch on Blender requires user skills.
Therefore, I developed a preferences UI that allows users to easily install PyTorch and download models.

If you are working on similar initiatives, please exchange information.

4 Likes

Great idea about the progress bar. I usually install modules with import pip and leave Blender freeze for while, not a good idea, but as I see with your code things are better.

Some other comments on the addon, though it might not make a big difference, but at least it would worth mention it, in terms of making the code sharper! :nerd_face:

[A]
Some operators are meant to be invoke from the user and must be searchable (as default). However other operators are only to be invoked only through UI elements thus their use is very limited. These can be turned to ‘internal’.
https://docs.blender.org/api/current/bpy_types_enum_items/operator_type_flag_items.html#rna-enum-operator-type-flag-items

class DownloadClipModel(bpy.types.Operator):
    bl_options = {'REGISTER', 'INTERNAL'}

[B]
Though it might be a great deal but you can reuse operators if needed, only to reduce boilerplate. As of these are identical. But only differe slightly.

class DownloadClipModel(bpy.types.Operator):
class DeleteClipModel(bpy.types.Operator):

So you kinda do this:

class DownloadLibrary(bpy.types.Operator):
  lib_name: bpy.props.StringProperty()
  def execute(self, context):
    if   self.lib_name == 'A': self.download_a()
    elif self.lib_name == 'B': self.download_b()
class MotionGenerateToolsAddonPreferences(bpy.types.AddonPreferences):
  def draw(self, _context: bpy.types.Context):
    op = col.operator(DownloadLibrary.bl_idname)
    op.lib_name = 'A'
2 Likes

Thanks for your comment :smiley:

I know almost nothing about bl_options.
So your suggesion will help me.

I think you are right, we could be more generalized in how we specify download models and dependent libraries.
For example, it would be a good idea to give requirements.txt.

1 Like