字幕表 動画を再生する 英語字幕をプリント [MUSIC PLAYING] LAURENCE MORONEY: Hi, everybody. I'm Laurence. I'm an AI advocate on the TensorFlow team and I'm here with my colleague and friend, Jason. JASON MAYES: Hi there. I'm Jason and I'm a developer advocate on TensorFlow.js. LAURENCE MORONEY: So here we're going to try to answer the questions that you post on social media with the hashtag #AskTensorFlow, so why don't we just get right down to it? JASON MAYES: Sounds good to me. First up, we have @adkumar who asked, how do we extend Keras APIs, model subclassing, and generally improve the ease of use? LAURENCE MORONEY: Oh, wow. That's a great question and it's one that we get a lot because, if you are new to TensorFlow, you probably are thinking it does everything that I need to do and training models and all of that kind of stuff. But then once you get a little bit more advanced into TensorFlow, you realize that, sometimes, you are trusting some code that was written for you by somebody else and you want to be able to subclass that. You want to be able to override that. You want to be able to customize it like custom training loops and that kind of thing. And that's a relatively advanced thing that you want to do, but a very important one as you get more advanced, particularly in research. So we've realized that the training and the information for this is kind of scattered all over the place. There's lots of files. I think the original question, he mentioned that there are over 100 files. JASON MAYES: Wow. LAURENCE MORONEY: I haven't counted them, but I'm sure there are quite a few. So I'm actually, right now, hard at work trying to put all of this together and produce a training course for advanced TensorFlow and advanced Keras, so teaching you some of that stuff such as subclassing some of the classes that are there, creating custom training loops, and all of that kind of thing so that you really-- I like to see it as driving stick instead of driving automatic. So we're working on that. We're hoping to get it published in the next few months, so just watch out and, hopefully, you'll have something that you can enjoy. So next question. This is one for you, Jason. JASON MAYES: Excellent. LAURENCE MORONEY: So @io62898019-- that's a great handle-- asked, what about web developers, and particularly, web developers who are new to AI and machine learning and they want to get started with all of this, but do they have a technology to help them? JASON MAYES: Indeed, we do, and that's why I'm here. We actually have TensorFlow.js, which is our JavaScript implementation of TensorFlow, and that means you can basically run it anywhere that JavaScript can run. So that might be client-side in the browser, in Node.js on the server-side, on Internet of Things like Raspberry Pi, and we've just announced support for React Native as well, so even in native app development, which is pretty neat. LAURENCE MORONEY: That's new to me. I didn't know that. Wow. Cool. JASON MAYES: And then, of course, if you are really prone to using Python, you can actually still use that. And we have a command line converter that allows you to convert the Python SavedModels into a TensorFlow.js format which you can then use in all of these environments as well. LAURENCE MORONEY: I love how you say prone to using Python. [LAUGHING] But which is one of the really nice things that-- like with TensorFlow.js where you can train it in the browser. JASON MAYES: Yes. LAURENCE MORONEY: It's not just for the data scientists that do Python and all that kind of stuff. So if you're a JavaScript developer, you don't have to learn something new. You can actually do your training in there. JASON MAYES: That's right. You can stick to what you're used to, I guess. LAURENCE MORONEY: Yeah. JASON MAYES: There are some caveats if you're going client-side or server-side. We've got smaller models. They work very well on the client-side and you got other features like privacy and such as well. And if you want to train larger models, then Node.js works just as well as Python does and can do all that hard, heavy lifting for you too. LAURENCE MORONEY: Nice. And one of the things I really liked about it, when I started playing with it, was that, if I'm a JavaScript developer who hasn't learned Python but I have teammates who've been building models in Python for a long time, there's a converter. JASON MAYES: Yes. LAURENCE MORONEY: Right? It converts the model into a JSON Object Notation. And then I can start using that, load my interpreter, and off I go-- JASON MAYES: Totally. LAURENCE MORONEY: --which is kind of cool. JASON MAYES: And another fun fact, if you are using Node.js, you can actually run SavedModels without conversion in node. LAURENCE MORONEY: Ooh. JASON MAYES: But you can't use them on the front end. So if you are just sticking to server-side in Node.js, then you can run Python models without conversion now. And they actually run slightly faster because of a just-in-time compiler, which is very cool. LAURENCE MORONEY: Very nice. Cool. I'm learning a lot today. Thanks, Jason. JASON MAYES: Awesome. LAURENCE MORONEY: And also one thing that-- just a shameless self-plug. I hope you don't mind. But a lot of the stuff around TensorFlow.js, when I got excited about it I decided to put together a course to teach. JASON MAYES: Of course, yeah. LAURENCE MORONEY: And I'm one of those who's prone to Python, so I did it from that perspective for people who are not necessarily just JavaScript developers but people who are Python developers who were used to building ML just to see how easy it is to do stuff in the browser. And we've got some cool projects that you can play with. JASON MAYES: Awesome. LAURENCE MORONEY: And it's all on Coursera if they want to check it out. JASON MAYES: I should have to take that one as well. LAURENCE MORONEY: Yes, please. Yes. I need all the students I can get. So actually another question for you. This one comes from @isbilen_erdem, and they ask, are there any TensorFlow.js transfer learning examples, in particular, for object detection? JASON MAYES: That's a really good question. That's something I was looking into when I first joined the team a little while ago. Before I answer that though, I just want to talk a little bit about object detection and what that is versus image detection. So object detection is essentially the ability to recognize one or multiple objects in a given image and also find their locations. You have little bounding boxes. That's different to image detection, which essentially allows you to know if something is in an image but not where it is, and also typically for one thing only. So now we know that. How do we do it in TensorFlow.js? Well, I think the easiest way to do this is actually to use Cloud AutoML, which now supports exporting the custom train models you make on there to TensorFlow.js format. LAURENCE MORONEY: OK. JASON MAYES: And of course, with that, you can then use that anywhere, as we discussed before. And you can check out the documentation to get started on that online. But essentially, all you need to do is have a folder full of images like cat images and then a CSV file that has the coordinates of the bounding boxes for each image showing where the cat is in each image. And that is then used as the training data to retrain the model to then work with your data. You then download that and then use it as you need to. LAURENCE MORONEY: OK. JASON MAYES: Yeah. LAURENCE MORONEY: That's pretty cool. So instead of you building a transfer learn model yourself, you're using an existing online model and having Cloud AutoML retrain that. JASON MAYES: Exactly, yeah. Doing this in TensorFlow.js for something like COCO-SSD might be a little tricky unless you have access to the full model, the original model, if you will. So if you don't have access to that, you can just leverage Cloud AutoML instead. LAURENCE MORONEY: So check out to Cloud AutoML documentation on that for details. JASON MAYES: Definitely. Sounds good to me. LAURENCE MORONEY: Cool. Should we go to the next question? JASON MAYES: Let's do it. OK, so next up we have @conradwt who asks, does TensorFlow leverage Metal when running on macOS? LAURENCE MORONEY: I take it they mean iOS and not macOS. JASON MAYES: Ah, yes. LAURENCE MORONEY: So there are a number of ways that you use Metal in iOS. The simple answer is yes, you can. So with TensorFlow Lite, there's a thing called the GPU delegate that allows you that-- some mobile devices have access to GPUs, some do not. On iOS, of course, it's more common to have access to the GPU. So with the GPU delegate in TFLite, you can actually effectively access Metal, which gives you the ability to run inference using the GPU so you can have much faster inference on the device itself. JASON MAYES: Very useful, yeah. LAURENCE MORONEY: Super useful. Faster inference means you're using less battery life, means you're more responsive at your application, and stuff like that. It's pretty cool. It's a bit complex to go over all of that here in this video, but I would say check out the tensorflow.org/lite site or search for GPU on that site as well and you'll see all the details. There's a whole bunch of stuff including some sample apps showing you how you can enable it and how you can use the GPU delegate so that you can just have a little bit of fun using your GPU to do faster inference on mobile, not just Metal in iOS, but also things like the Neural Network API on Android. JASON MAYES: Nice. Very cool. LAURENCE MORONEY: So the next question that came in was from @rishabh16, and they asked, what's the best way that someone like a high school student could engage with TensorFlow and could learn maybe some of the basics around ML and start doing some real things, and then from that, then be able to move onto the different components and submodules for their projects and their work. JASON MAYES: Sounds good. LAURENCE MORONEY: What's a good way for a high-schooler to get started? JASON MAYES: So I guess, when you're starting out, you want to kind of try something a little more graphical to get started to just learn how things need certain amounts of training data and what biases might come into this kind of situation. So I recommend checking out a website called Teachable Machine, which is made by Google. And it allows you to simply point your webcam at various objects, or maybe use a microphone, whatever you want to use, and train on that data. And within about one minute, you can have a machine learning model that can classify speech or objects and even poses, which is pretty cool. LAURENCE MORONEY: Right. So very quickly, within the browser, being able to put something together so they can just see how machine learning models work? JASON MAYES: Exactly. And they can try it live after the model's trained. The webcam would be fired up and you can then re-point it at the things you're training on and see the class it predicts right there in the browser in real time, super low latency. And if you like it, if it's actually useful to you, you can then download that model. It's just a JSON file essentially, which you can then reuse on any website you wanted to play that on essentially. LAURENCE MORONEY: Nice. What a great way to get started. JASON MAYES: Very cool. I wish we had that back in my day. LAURENCE MORONEY: Like last year. JASON MAYES: Yeah, yeah. [LAUGHING] So next up, we have @1amarvind who asks, what are TensorFlow Records and why are they needed for input? LAURENCE MORONEY: That's a great question. And to understand why you need TensorFlow records, you have to kind of double click a level above that and think about data. Data is really the lifeblood in training any kind of machine learning application. But data comes in all shapes and sizes. JASON MAYES: That's very true. LAURENCE MORONEY: That might be a zip file over here with images. There might be CSV files if you are inclined to be a JSON person. Might be JSON files, those kind of things. And without having a lot of skills and being able to understand this, it becomes a huge learning curve for people to say, OK, which one am I going to use? How am I going to use it? How do I unzip? How do I use JSON? And when I've seen a lot of people building models, you might have this much code for building a model, but this, much is the model architecture-- JASON MAYES: Sure, yeah. LAURENCE MORONEY: --and this much is downloading the data, figuring it out, putting it into formats like-- I'm Python inclined, and putting it into NumPy format so that I can do training, or if it's .js, putting it into JSON sort of Tensors so that I can do training. And it's a whole amount of calories that I have to burn before I can even get started. JASON MAYES: That's very true. LAURENCE MORONEY: So the idea behind TFRecord and something called TensorFlow Data Services and TensorFlow Datasets is to try and make that as easy as possible. So what we've done is we've taken a whole bunch of different data sets and put them into an API so that, with one or two lines of code, you have everything that you need to start training. JASON MAYES: Very cool. LAURENCE MORONEY: So now, instead of going from this with this much for your data, you're going from this to this with only this much for your data-- JASON MAYES: Very nice. LAURENCE MORONEY: --if that visualization works OK. So things like that, and then the core of that is the TFRecord. So you need to have one kind of base class from which you can do everything. And then, when you're doing that, there's all of these different optimizations for training like if you're doing distributed training and you want to manage pipelines. And I always like to think about it as, say-- take for example, you have a CPU and a GPU and you're going to do your training on the GPU but you do all your data pre-processing on the CPU. So the CPU is grabbing the data and handing it to the GPU. And then while the GPU is working, the CPU also has to be doing something, and to get the two of these to work in parallel can be very difficult. JASON MAYES: Sure. LAURENCE MORONEY: So there's a lot of pipelining technology in TensorFlow, and that is built to use TFRecord to be able to manage all that data. JASON MAYES: I see. Very neat. LAURENCE MORONEY: It seems like one small thing. And you might think, well, why on earth would I want to use this when I've got CSV or I've got databases or all of that kind of thing? But once you start using it in that way, you'll see it has great benefits for your training. JASON MAYES: Awesome. LAURENCE MORONEY: So that's it. Great questions. It was a lot of fun answering them too, right? JASON MAYES: It was indeed. LAURENCE MORONEY: So don't forget, on social media-- YouTube, Twitter, wherever you like-- hashtag #AskTensorFlow and we'll do our best to answer those questions. And Jason, I think some of the stuff you spoke about today you'll have online demos for. JASON MAYES: Indeed. We've got some live demos, and we're going to publish those for you guys to see at home because it all runs in the web browser after all. LAURENCE MORONEY: That's one of the nice things about JavaScript. JASON MAYES: Indeed. LAURENCE MORONEY: All right. So thank you, and we'll see you around. [MUSIC PLAYING]
A2 初級 最新のTensorFlowの質問にお答えします!#AskTensorFlow (Answering your latest TensorFlow questions! #AskTensorFlow) 3 0 林宜悉 に公開 2021 年 01 月 14 日 シェア シェア 保存 報告 動画の中の単語