Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by matealukic · Dec 03, 2020 at 08:22 PM · modelclasseswebcammodel importingmodelimporter

TEACHABLE MACHINE MODEL & UNITY

Hello, I have a "little" struggle here. My problem is that I am not good with C# or Java. I'll appreciate very much if somebody helps me with my little project that I can't attach but I can send in e-mail. I want to integrate TM model in simple UNITY 2D game. I made a Teachable Machine Model (Tensorflow PoseNet Model) that recognize Jumping-Jack pose (class1) and everything that is not Jumping-Jack pose (Class2). Input is from WebCam (LIVE). My model is on picture below : alt text

Game is very simple. On PLAY mode my player is moving constantly and when I press "space" key, player jumps. (picture below)

alt text

I need to ::: 1. include WebCam 2. include my model using link : https://teachablemachine.withgoogle.com/models/JXKFF-drd/

  1. add variable "Classifier" with labels class1 / class2

  2. change condition: " if(space is pressed) DO JUMP " in " if (classifier == "class1") DO JUMP "


Here are some links that might help to someone who is better with C# and Java than I am : https://dylandawkinsblog.wordpress.com/2019/05/08/machine-learning-for-web-final/ https://www.youtube.com/watch?v=UPgxnGC8oBU

This is a code that I have so far - Script is attached:

using System.Collections; using System.Collections.Generic; using UnityEngine;

public class kretanje1 : MonoBehaviour { Rigidbody2D rb;

 // Player Movement Variables/....
 public static int movespeed = 3;
 public Vector3 userDirection = Vector3.right;

 public float jumpForce;
   
 void Start()  // Start is called before the first frame update
 {
     rb = GetComponent<Rigidbody2D>();
 }

 void Jump()
 {
     if (Input.GetKeyDown(KeyCode.Space))
     {
         rb.velocity = new Vector2(rb.velocity.x, jumpForce);
     }
 }

 void Update()      // Update is called once per frame
 {
     transform.Translate(userDirection * movespeed * Time.deltaTime);
     Jump();
 }

}

tm2.jpg (45.4 kB)
game.png (10.7 kB)
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by UnderShad · Dec 03, 2020 at 09:04 PM

I tried implementing tensor flow in unity but above the unity own ML Agents things get very difficult to implement. May be you can use backend api to send data from the model to realtime database using firebase and link firebase to unity.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

143 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How to deflate/inflate a model + How to rip from a model from another game? 0 Answers

Binary Model Format 1 Answer

Models don't work as a gameObject in my script, i'm confused! Help! 1 Answer

Model rotations are locked 1 Answer

C# Weapon class generation 2 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges