Speaker 1: Welcome to Alixer Mix, your Elixer podcast talking with members
Speaker 1: of the community. My name is Mark Erickson, and today
Speaker 1: we're joined by Sophie de Benedetto. Hey guys, and our
Speaker 1: guest Alvisa Sousmel.
Speaker 2: Hello, thanks for having me.
Speaker 3: I'm glad you could come on.
Speaker 1: So this is an exciting topic for me because it's
Speaker 1: something I find fascinating. I think whenever I hear about this,
Speaker 1: I think, Wow, that's super advanced and futuristic, and I
Speaker 1: have no idea how to do it myself. And so
Speaker 1: we've invited Alvisa on to help talk about how to
Speaker 1: do this, and so like what we're talking about is
Speaker 1: using like image recognition with the Elixer.
Speaker 3: And really cool stuff like that.
Speaker 1: So first of all, Alvisa, maybe you could tell us
Speaker 1: like where you work and a little bit about yourself,
Speaker 1: what kind of problems you're solving.
Speaker 4: Yes, sure, Seeing the last five six years I've been
Speaker 4: a CEO in a London hedge fund and I'm still
Speaker 4: working from them as a consultant and at the moment
Speaker 4: I'm consulting and running queticoding dot com, which is an
Speaker 4: educational site which is at the moment is mainly focused
Speaker 4: on Elixir and Phoenix, and I'm working to make some
Speaker 4: free and paid Elixir Phoenix courses. And my current clients
Speaker 4: are from finance, so the problems I'm facing are similar
Speaker 4: to what I've faced so far at the edge fund,
Speaker 4: and so to describe what kind of problems I had
Speaker 4: to face at the hedge Fund, We've designed three different architectures,
Speaker 4: mainly process data in real time. So the first was
Speaker 4: the process data for real time traits coming from different
Speaker 4: texchanges for hundreds of different products, products, our financial products,
Speaker 4: different assets, and the goal of this platform is to
Speaker 4: use the data to run our trading models. And in
Speaker 4: this case we had we have a lot of Python
Speaker 4: code because all the data science framework there are really
Speaker 4: great data.
Speaker 2: Science framework there.
Speaker 4: And another platform was is to process financial tweets in
Speaker 4: real time, so we get a huge amount of tweets
Speaker 4: in real time. We run our machine learning models to
Speaker 4: cluster these tweets to understand which company they refer to,
Speaker 4: and then the system generates a minute by minute sentiment
Speaker 4: for each company which is useful in different trading situations.
Speaker 4: And we have also another platform which is an internal
Speaker 4: platform for research. Is like a set of research tools
Speaker 4: we used to exchange in form about research. So what
Speaker 4: they have in common is the need to process real
Speaker 4: time let's say events, and to especially to self heal
Speaker 4: because we need we need to stay up. Obviously it's
Speaker 4: not one hundred percent, but we need to stay to
Speaker 4: be reactive to any kind of anomaly, and to.
Speaker 2: Process UH trades as far as fast as we can.
Speaker 3: Nice.
Speaker 1: So you mentioned in there like the need to leverage
Speaker 1: other libraries or languages outside of UH you know, Corelixer,
Speaker 1: and it seems like in today's development environment that seems
Speaker 1: to be increasingly the case because you have, like you'd mentioned,
Speaker 1: data scientists who are using their own tool set of tools,
Speaker 1: and they already have these libraries that are being built
Speaker 1: up by a whole community of people, and a.
Speaker 3: Lot of those tend to be in Python.
Speaker 1: And historically, just as web developers, I think we you know,
Speaker 1: you're you're accustomed to having work with multiple languages because
Speaker 1: you have a front end which might be written in
Speaker 1: JavaScript and a back end which is written in something else.
Speaker 1: Some people do approach, you know, take Node as a
Speaker 1: back end, but you know we have a lixer, or
Speaker 1: you've done Ruby on rails or Java or something else,
Speaker 1: and then you have mobile on the front end. You know,
Speaker 1: you're dealing with you know, mobile frameworks and mobile languages
Speaker 1: and different platforms. So it's like we are kind of
Speaker 1: in this area and this environment where we have to
Speaker 1: deal with multiple types of tools, multiple communities. And so
Speaker 1: one of the things I think is interesting is this
Speaker 1: whole idea about how Python has a lot of these
Speaker 1: libraries for doing like image recognition, for doing you know,
Speaker 1: like where you know, be it Python or not. But
Speaker 1: I might be using GPUs to do accelerated computing. And
Speaker 1: so what I loved about your article is that you're
Speaker 1: you're totally acknowledging that, right that there is stuff that
Speaker 1: we need to use that's not an elixir. So we
Speaker 1: want to basically try to leverage the benefits of each
Speaker 1: the strength of each language and each platform to do
Speaker 1: what they're best at. So maybe you can tell us
Speaker 1: a little bit about this blog post that you wrote
Speaker 1: and kind of give us an introduction to this topic
Speaker 1: of what you're trying to do.
Speaker 4: Yes, sure, the so the blog post is about real
Speaker 4: time object detection uh and the idea of using real
Speaker 4: time object detection in Phoenix UH. Well, in Elixir and
Speaker 4: then using Phoenix to render the result.
Speaker 2: So obviously the idea.
Speaker 4: Of the of the blog post is not to reinvent
Speaker 4: the will is actually to use something that is already there. So,
Speaker 4: as you said, there are great frameworks in Python and
Speaker 4: UH is there are also high level libraries like a
Speaker 4: civy lip which uses open cv under the hood, and
Speaker 4: UH it's super easy to use. And you can just
Speaker 4: pass an image to this to a function and UH
Speaker 4: dysfunction returns uh list of detected objects and UH and
Speaker 4: the coordinates of these objects.
Speaker 2: So in the in the article, I actually uh uh
Speaker 2: go through UH the.
Speaker 4: Idea of interfacing and trying to take advantage of this
Speaker 4: library UH inside the Elixir, and I went through different ways
Speaker 4: of communicating with with Python. Well, the simplest one is
Speaker 4: to just launch just run UH the Python process. The
Speaker 4: problem of this is that two for example, in this
Speaker 4: specific case, we have a neural network, which is a
Speaker 4: neural network, well actually a convolutional neural network, and to
Speaker 4: load this model it takes around two three second on
Speaker 4: a matwork pro and obviously we can't run this UH
Speaker 4: this script for each single frame or each single image
Speaker 4: we want. And so we need a long running process.
Speaker 4: That means we we keep the model in memory and
Speaker 4: and we keep the Python process in memory, and we
Speaker 4: control it via something is called a port. So a
Speaker 4: port in a in Elixir and in Airline, it's a
Speaker 4: mechanism to launch an operating system process which is external
Speaker 4: to the bm UH. And this brings a lot of advantages. Well, first,
Speaker 4: if the process crashes, it doesn't bring down the bim UH,
Speaker 4: so it's something external.
Speaker 2: And we can communicate.
Speaker 4: With this process via message passing and the standard IU UH.
Speaker 2: And what I do through the article is to.
Speaker 4: Is to use ports to build UH, to build UH,
Speaker 4: this communication to H with the with this UH Python
Speaker 4: framework and be able to link the camera from UH
Speaker 4: from the web browser, take the frames from the web browser,
Speaker 4: send this frame across UH a web socket to a
Speaker 4: Phoenix channel, and then Elixir sends UH these frames to
Speaker 4: the Python side detected which actually runs the the real detection.
Speaker 4: And and yeah, the the thing is is so easy
Speaker 4: to use this approach to bring and to use to
Speaker 4: take advantage of machine learning. And since Python is so so.
Speaker 2: Far on the machine learning side.
Speaker 4: Actually, one of the reasons Python has a huge adoption
Speaker 4: rate is because all these frameworks in the last ten years,
Speaker 4: the adoption rate increased a lot. But because these frameworks,
Speaker 4: not because the language itself. And yeah to me, to me,
Speaker 4: I think Elixir would be great. I actually would prefer
Speaker 4: to control a machine learning library with Elixir rather than
Speaker 4: Python with pipes and struct and like generate a struct
Speaker 4: with it, which is like a job.
Speaker 2: I want to run a machine learning job. I want
Speaker 2: to run and then.
Speaker 4: And then send this job to to a Python to
Speaker 4: a Python process with the with depart or with other
Speaker 4: solutions like.
Speaker 2: Uh, there are other ways like uh E p M D.
Speaker 4: So the is said there is a library called remember
Speaker 4: correctly pyre lank UH and UH, the it's possible to
Speaker 4: uh to create a Python node. UH, just to say
Speaker 4: there are other ways we can interface with the with
Speaker 4: the Python process.
Speaker 1: So one of the ways if I can just kind
Speaker 1: of clarify the way I understand ports to work.
Speaker 3: UH.
Speaker 1: I have used ports before, and UH in my case
Speaker 1: I was talking to we needed some you know, we're
Speaker 1: migrating a Ruby on Rail's monolith to Elixir, and so
Speaker 1: there's some things that Ruby still.
Speaker 3: Did best because of libraries or whatever.
Speaker 5: You know.
Speaker 1: I don't want to re implement an entire life library
Speaker 1: just so I can have this little piece of functionality
Speaker 1: so as ports as I understand it, Like what I'm
Speaker 1: able to do is I can start up the process,
Speaker 1: the OS level process that is running Ruby in my
Speaker 1: case or Python in your case. And so you're like
Speaker 1: you're describing you like this two to three second load
Speaker 1: time just to load everything that it needs for the
Speaker 1: for doing the memory yea, for doing its processing. And
Speaker 1: so once that load is done, then it's just basically
Speaker 1: it's messaging through like I think it's even just standard
Speaker 1: out kind of just directly kind of talking through the
Speaker 1: OS to the other process, not even through like an
Speaker 1: HTTP kind of you know port like you know web
Speaker 1: ports or anything like that. It's not a web servers,
Speaker 1: just talking directly to it. So that has a cost,
Speaker 1: I guess in terms of serialization about how do I
Speaker 1: actually communicate and how do I serialize my data to
Speaker 1: send it across to this other process. But that that's
Speaker 1: one of the benefits is uh, it's it can now
Speaker 1: be supervised by the beam, right, so if something goes
Speaker 1: wrong in my library and it crashes, elector can respond
Speaker 1: to that, right have you?
Speaker 3: Is that something you've been able to see as well.
Speaker 4: Yes, absolutely, this is exactly one of the advantages and
Speaker 4: uh uh with part, especially if we wrap a part,
Speaker 4: if we wrap a gen server around the part, it
Speaker 4: becomes super easy to uh to supervise it.
Speaker 2: So yes, in the article I, what I do.
Speaker 4: Is to uh wrap dispart uh with with the gen
Speaker 4: server UH, and it's possible to run like to start
Speaker 4: monitoring this part. So when the process crashes, we just
Speaker 4: receive a message to the owner process which is an
Speaker 4: exit message. And so in this case we can deal
Speaker 4: inside the gen server UH. And we can just like
Speaker 4: rerun the part without letting the supervisor do that, without
Speaker 4: having to delegate this to the supervisor. Or we can
Speaker 4: just decide to not handle the exit process the exit message,
Speaker 4: and what happens is that the the gen server process
Speaker 4: just crashes and if it's supervised uh, it's restarted again.
Speaker 2: Another another advantage is.
Speaker 4: Is that of this wrapping wrapping the part with the
Speaker 4: gen server is that we can only the owner, so
Speaker 4: only the process that starts the part can communicate with
Speaker 4: the part. So can send a message which is propagated
Speaker 4: via via standard input to the to the Python process
Speaker 4: and the same as receiving messages from the Python process,
Speaker 4: So only the owner can do this messaging. So if
Speaker 4: we want to use a port and let's click, it's
Speaker 4: not sure. But if we want to use this sport
Speaker 4: and send messages to this sport from many processes, we
Speaker 4: need a gen server that is the owner and takes
Speaker 4: the ownership of this port. So I think most of
Speaker 4: the cases is better to use a gen server, I mean,
Speaker 4: especially in this case. And also another advantage is that
Speaker 4: if like in this case, if we want to scale,
Speaker 4: if we want to scale horizontally, if a port is
Speaker 4: embedded is handled via gen server, is easy to spown
Speaker 4: a pool of distributed.
Speaker 2: Gen server workers.
Speaker 6: Yeah, I just want to point out how kind of
Speaker 6: incredible that is, and how Elixer's flexibility around like interrupt
Speaker 6: in this case with Python is so powerful because what
Speaker 6: you're doing is you're leveraging like the concurrency and the
Speaker 6: ability to manage processes that Alixir gives us and still
Speaker 6: getting like that powerful bit of Python functionality that is
Speaker 6: best suited to do that image detection. And that's why
Speaker 6: I kind of think it's fun to say, like, oh,
Speaker 6: Alixer is kind of good at everything, because in a way.
Speaker 6: It is because it's good at using the things that
Speaker 6: are better at the thing it can't do. And that's
Speaker 6: really awesome.
Speaker 2: Yeah, it's it's a fantastic glue in these cases. Is well.
Speaker 2: First is I.
Speaker 4: Think that the language itself is great, So most of
Speaker 4: the time I prefer to handle these kind of things
Speaker 4: and to glue things with Elixir. And at the beginning,
Speaker 4: I thought that this part mechanism could have huge limits.
Speaker 4: At the beginning, I thought, okay, if I send, because
Speaker 4: the experiment I did well. One of the experiments I
Speaker 4: did is to was to send the row frames like
Speaker 4: at thirty frame per second, so each frame is around
Speaker 4: the three megabyte, so I was sending around one hundred
Speaker 4: megabyte per second, and I thought, okay, maybe maybe I
Speaker 4: could have huge delays because there is messaging, there is IO.
Speaker 4: But actually each single message was sent the time the
Speaker 4: roundtree time I measured is like half millisecond for each
Speaker 4: single frame, which is I mean nothing, especially if we
Speaker 4: want to run a real time object detection at thirty
Speaker 4: frame per second. I mean, I was really impressed by
Speaker 4: how fast is this mechanism? And yeah, how easy is
Speaker 4: to take this approach and scale arizontally, especially when when
Speaker 4: when the party is embeddeding engine server, then we can
Speaker 4: use all the advantages of elix heir all the libraries
Speaker 4: like like a poor Boy or other libraries and supervision
Speaker 4: and it's I mean almost we get everything for free.
Speaker 3: Yeah.
Speaker 1: I love how Sophie kind of described that too, because
Speaker 1: I do think that is a strength of Elixir and
Speaker 1: the Beam in particular. It's just to say that it
Speaker 1: is a great interoperability messaging kind of platform, so that
Speaker 1: it's like it is the way I can manage to say,
Speaker 1: these are the things I want done, and then I
Speaker 1: can push that out through you in a distributed way
Speaker 1: out to the workers who this one might be rust
Speaker 1: and it's doing something, and this one might be Python
Speaker 1: and just doing something, and then bring all those back
Speaker 1: and be able to aggregate and report and do everything
Speaker 1: like that. So it really kind of comes back to
Speaker 1: it's like wow, you know, it's kind of like this
Speaker 1: telephone communication kind of system, and it's like, you know,
Speaker 1: it's like wow, who to thunk?
Speaker 3: So it's kind of fun.
Speaker 1: But what I love is like in my case, except
Speaker 1: for like a couple examples like I gave with like Ruby,
Speaker 1: where I was needing to go to something because of
Speaker 1: a library as a gem that I needed to support
Speaker 1: for Otherwise, it's like, I don't. I don't have any
Speaker 1: personal needs where I need to go out to those
Speaker 1: other things. I don't have performance requirements where I say
Speaker 1: I need to go to RUST.
Speaker 3: I don't.
Speaker 1: I'm not doing anything with right now with machine learning.
Speaker 1: We'd like to at some point in the future, but
Speaker 1: you know, at some point that's where I will go
Speaker 1: and I will be interoperability kind of talking with Python.
Speaker 1: So I love that I can do it, but I
Speaker 1: don't have to do it. Yeah, Elixer still does everything
Speaker 1: I need to write where I am right now.
Speaker 5: Yeah.
Speaker 6: I think it's also it's also kind of like a
Speaker 6: useful case to make or argument to have in your
Speaker 6: back pocket when you're dealing with adoption. You know, if
Speaker 6: you're trying to convince your team or colleagues to use
Speaker 6: Elixir for a particular project, and you know, people are
Speaker 6: looking down the line and they're thinking, well, what about
Speaker 6: when we need something that Python is better suited for,
Speaker 6: or what about when we need to solve this problem
Speaker 6: that you know, typically folks may reach for rest for
Speaker 6: you can kind of trop this out and say, like,
Speaker 6: we can use Elixir now so that we can move fast,
Speaker 6: so that we can leverage like a nice design, so
Speaker 6: that we can take advantage of all the fantastic Elixer
Speaker 6: things around concurrency and fault tolerance. And when we need
Speaker 6: something else, we need a tool that's better suited for it.
Speaker 5: We have it backed ourselves into a corner.
Speaker 6: We're not in a place where we need to, you know,
Speaker 6: spin up a separate service and another language and framework
Speaker 6: and then figure out what this communication mechanism would look like.
Speaker 5: I think one of the things that you mention in
Speaker 5: your article obvious is.
Speaker 6: That you know, you could have reached for HTTP communication.
Speaker 6: You know, both some API end points where you're going
Speaker 6: to communicate between your alexro Phoenix app and you know
Speaker 6: this this Python application.
Speaker 5: But we don't have to. We don't need that.
Speaker 6: Overhead, we don't need that complexity. Ports are one way
Speaker 6: among some others that Alexa just makes it super super
Speaker 6: easy to enact that kind of communication.
Speaker 4: Yes, compared to for example, HTTP, which is obviously the first,
Speaker 4: I mean the first thing that came to my mind
Speaker 4: when I wanted to do something like this, And the
Speaker 4: problem is supervision and especially on embedded devices. I mean,
Speaker 4: if I want to run this thing, a real real
Speaker 4: time outject detection system, that is that does something if
Speaker 4: I find some objects in the pictures in the frames
Speaker 4: coming from the camera, I have an if I run,
Speaker 4: for example, a Python worker that has flask like an
Speaker 4: HTTP UH server, I mean usually most of the time,
Speaker 4: especially on an embedded device, I want to supervise this
Speaker 4: process or this worker, and if I'm able to supervise
Speaker 4: it via elkx heir, I'm much happier, especially because this
Speaker 4: means I don't have to well, I know what's happening
Speaker 4: inside Elixir, so inside the Elixir, I know if my
Speaker 4: workers are fine or not, and I don't have to
Speaker 4: install some other services like well, I don't know kubernatists.
Speaker 4: Maybe not in an embedded device, but it's something that
Speaker 4: I could run on a on a different in a
Speaker 4: different case if I want to UH scale easily and
Speaker 4: supervise different services.
Speaker 2: So this parts and makes this much easier.
Speaker 4: And another solution, as Mark said, UH with with another
Speaker 4: solution to communicate UH for example, like with the with rust,
Speaker 4: it would be uh niffs. So I went through also
Speaker 4: that path and so yallow which is uh.
Speaker 2: It's an acronym for you only look once. Which is
Speaker 2: the algorithm behind the object real time object detection. This
Speaker 2: is a state of the art object detection system which
Speaker 2: is with a real really uh simple, with the n
Speaker 2: Vida GPU with its not cheap but around the five
Speaker 2: hundred dollars GPU. Uh, you can detect objects at a
Speaker 2: thirty different per second.
Speaker 4: Uh.
Speaker 2: And the thing is uh.
Speaker 4: The the creator of this algorithm they he did the
Speaker 4: C version C and COUDA versions. So I said, okay,
Speaker 4: maybe I could do a NITH. So first it's so
Speaker 4: far easier to uh do to use the part with
Speaker 4: a Python a high level library, then create an diffan
Speaker 4: see and trying to interface with to to bind to
Speaker 4: create a binding to this library and the But the
Speaker 4: main thing, Uh, what happened is that the first time
Speaker 4: I compiled there was an error in my ce neth
Speaker 4: and obviously uh it crashed. The problem is that everything crashed,
Speaker 4: the beam crashed, and so yeah, there are ways to
Speaker 4: deal with it. Well, first is use rust.
Speaker 2: The thing is, uh, I didn't find anything.
Speaker 4: I mean, there were some libraries, some bindings with open
Speaker 4: CV with rust. By the things when quite quite complicated,
Speaker 4: quite easily, so I said, okay, ports is far better
Speaker 4: to me.
Speaker 2: I mean, I'm not. I tried many things.
Speaker 4: But if I, if I would go back, I would
Speaker 4: just use ports in this case. In this case because
Speaker 4: the detection time is still around a twenty million second,
Speaker 4: which is reasonable, reasonable time to wait to delegate a
Speaker 4: job to a Python process. Obviously, if I just want
Speaker 4: to do a sum from for two floats, a part
Speaker 4: doesn't isn't isn't isn't the best way because just this
Speaker 4: messaging it costs the time. But and in that case
Speaker 4: maybe it's better to use to use a NIF. But
Speaker 4: for things that are longer that than you milli seconds
Speaker 4: parts is easier and safer uh and uh safer than
Speaker 4: cm in uh and um yeah so and uh and
Speaker 4: and also is we were able to just use a
Speaker 4: high level library rather than something.
Speaker 2: With a lower level.
Speaker 3: I think it's funny the library called Yolo.
Speaker 1: You know, I I thought it was like you only
Speaker 1: live once, but I can't.
Speaker 3: That can't be it. So that's really cool. It's like
Speaker 3: you only look once.
Speaker 5: Uh.
Speaker 1: But what I love about your article, and I just
Speaker 1: want to encourage you, dear listener, to check out the
Speaker 1: article because if you if this is an interesting topic
Speaker 1: to you at all in doing image detection, and you're
Speaker 1: just kind of like like me, like I'm anew with this. Uh,
Speaker 1: this is an awesome article because Alvisa has put a
Speaker 1: ton of effort into this.
Speaker 3: It is detailed, it has you know.
Speaker 1: One of the things I just love watching in this
Speaker 1: is the real time ish kind of updates of as
Speaker 1: it's classifying you know, video and it's like he holds
Speaker 1: up a remote you know, water bottle and it's like, oh,
Speaker 1: and it's drawing boxes around things, and as he gets
Speaker 1: up and walks around and how it's following, you know,
Speaker 1: classifying a person.
Speaker 3: It's like, that's really cool. So I was curious as to.
Speaker 1: What kind of you've mentioned, like the the idea of
Speaker 1: doing something embedded. Is this a personal project something you're
Speaker 1: kind of playing with and exploring, Like what kind of
Speaker 1: is driving this?
Speaker 2: Yes, so there are two goals.
Speaker 4: Yes, it's a personal project, but it's driven from actually
Speaker 4: business needs. So I worked with Python in most of
Speaker 4: the time in the last five six years a Python
Speaker 4: and well in the last three years leisure uh, and
Speaker 4: I always needed to uh to deal with this five
Speaker 4: well at the beginning, I thought it was a fight.
Speaker 4: Oh but there is this on Python. I would like
Speaker 4: to have it in elix yir. I really don't like this.
Speaker 4: Uh two, it's not that I don't like Python, but
Speaker 4: I prefer to write elix heir.
Speaker 2: Uh.
Speaker 4: So I started actually to find ways to bring different
Speaker 4: kind of problems more on like historical uh a list
Speaker 4: of historical prices, uh.
Speaker 2: Volumes of trades. Uh so Uh.
Speaker 4: What I wanted to find is that like a generic,
Speaker 4: generic way to deal with this kind of interactions between
Speaker 4: Elixir and uh and and Python. So the best way
Speaker 4: was to find a heart problem I mean hard in
Speaker 4: the sense of processing something like I mean, uh, this
Speaker 4: model is one of.
Speaker 2: The uh toughest on the processing side.
Speaker 4: Uh and uh it's it's so this uh a yallow
Speaker 4: needs to be to.
Speaker 2: Run yeallow until a three different per second.
Speaker 4: We need to be uh faster, not only on the
Speaker 4: processing side of yallow. I mean that obviously, especially if
Speaker 4: we take this function of the high level library. There
Speaker 4: is there is there isn't anything we can do, but
Speaker 4: what we can do is to work on the boundaries.
Speaker 2: So I said, okay, this is a great problem.
Speaker 4: Also to find a like a generic way to handle UH,
Speaker 4: this interfate interaction with Python also to deal with other
Speaker 4: things I had in mind, like classification of a series
Speaker 4: of UH prices. So this is actually what driven. It's
Speaker 4: a mix of personal and business. And then I got
Speaker 4: hooked by the problem itself and I started to say, okay, oh,
Speaker 4: but there is this jetson nano which is an Nvidia
Speaker 4: device and at the device it's a ninety nine dollars
Speaker 4: UH and is an embedded device.
Speaker 2: UH which is powered by.
Speaker 4: UH that the power supply is from Amery correctly ten bots.
Speaker 4: And the cool thing is that it has an an
Speaker 4: Nvidia GPU, so we can run TensorFlow GPU or the
Speaker 4: Kuda version of the of the yollow of the yellow
Speaker 4: convolution on neural network, which this means it runs much
Speaker 4: much faster than on a CPU UH.
Speaker 2: So I said, okay, that's great. So now that I have.
Speaker 4: A gen server and that that runs this detection along
Speaker 4: with the Python process, what if I buy a few
Speaker 4: of these devices and by the devices and I linked
Speaker 4: them via Elixir distributed Elixir distributed around. So this means
Speaker 4: each single device UH runs a worker. So each single
Speaker 4: device is a node which runs a worker and Uh.
Speaker 4: One of these is a master that has a camera
Speaker 4: and actually use uses the other devices to spread the
Speaker 4: load of this classification of this attraction across different all
Speaker 4: the devices. And uh, this is what I did. Actually
Speaker 4: I voted two devices because I don't didn't want to
Speaker 4: spend two too many.
Speaker 2: Dollars on this. But uh what day saw?
Speaker 4: Actually I linked also my computer to the to the
Speaker 4: to the cluster.
Speaker 2: And uh it Uh it scaled ririzontally super easily.
Speaker 4: I just needed to do something like a management module
Speaker 4: which uh uh which does something like a round robin
Speaker 4: so uh, it knows which node is which node and
Speaker 4: the worker is busy and which one is free.
Speaker 2: So as soon as it receives.
Speaker 4: Uh, the it's like a broker, so it receives uh
Speaker 4: the frame uh knows where to where to sign it.
Speaker 3: Uh.
Speaker 4: And it was super easy. The thing is with the
Speaker 4: Elixir was super easy. And I said, okay, if I
Speaker 4: let's see if I want to do it in Python. Uh,
Speaker 4: it's not, It's absolutely not that easy.
Speaker 2: It's not.
Speaker 4: There are so many free things in Elixir when it
Speaker 4: comes to the scaling horizontally in a distributed manner that it's.
Speaker 2: It's amazing that's cool.
Speaker 1: So yeah, you have a link to this, and I
Speaker 1: included a link to in the show notes to this
Speaker 1: Nvidia jets and nano device which is looks like it
Speaker 1: retails for about one hundred dollars US, which which I
Speaker 1: think is super cool that you can do like coudacors
Speaker 1: on this little super embedded thing and have a little
Speaker 1: cluster of them and have workers and farm out, you
Speaker 1: know work, which is like you think of like, okay,
Speaker 1: well if I was going to actually do this, you know,
Speaker 1: that is the kind of device that I could sell
Speaker 1: and have like in the office area that is processing
Speaker 1: the sensor data and the images that are being captured
Speaker 1: and doing all of my processing. So very cool. I
Speaker 1: had not seen anything like that. Didn't know that was available.
Speaker 3: You know.
Speaker 1: It's like Raspberry Pie is the thing that everyone kind
Speaker 1: of talks about because it is the most approachable place
Speaker 1: to start. But yeah, when you're talking about machine learning,
Speaker 1: you're wanting to go like coud decors and using the
Speaker 1: libraries that are already there.
Speaker 3: So very cool.
Speaker 1: Well, we are coming about about up to our time.
Speaker 1: Is there anything else you want to mention before we
Speaker 1: transition side One other thing we haven't touched on. Is
Speaker 1: just that you had mentioned in your articles and just
Speaker 1: the idea of like also using scenic Oh yeah, okay, so.
Speaker 3: Maybe you could talk about that for a moment.
Speaker 2: Yes.
Speaker 4: The first thing I I I tried is to use
Speaker 4: a Phoenix to.
Speaker 2: To render, especially to render the results.
Speaker 4: So because I needed to get frames as as easy
Speaker 4: as I could from from the camera, so I said, okay,
Speaker 4: let's try it with Phoenix, especially because I can use
Speaker 4: it also to render as the frames and the result
Speaker 4: with as VG. Obviously, this is not the best way,
Speaker 4: is the easiest way. It was the easiest way. It's
Speaker 4: not the best way because there is this because frames
Speaker 4: are frames are sent around from Phoenix from the browser UH,
Speaker 4: and the browsers sends the UH. The frame is to
Speaker 4: as a basic sixty four encoded we have two decode THEMS.
Speaker 2: And to the Python workers.
Speaker 4: So it's so what it did is to say, okay,
Speaker 4: I saw that the throughput I could get with parts
Speaker 4: is great, and so I could actually use Python and
Speaker 4: open CV to get the frames. So to get the
Speaker 4: frames directly from the camera especially is great if we
Speaker 4: use it with on embedded device UH. And what they
Speaker 4: do well, the first advantage is that open CV.
Speaker 2: Works well to get the frame. We have the frame
Speaker 2: in memory, UH, and.
Speaker 4: The representation is a NUMPI metrics UH. NUMPI is UH
Speaker 4: is a is a library in Python to deal with
Speaker 4: matrices and and UH. The cool thing is that we
Speaker 4: don't need we have this image in memory, we don't
Speaker 4: need it's a ROW representation of the image, and so
Speaker 4: we don't need to send send the image to other processes.
Speaker 4: We just need to classify, run the classify, the the
Speaker 4: yallow object detection. And what I so at the beginning,
Speaker 4: I said, okay, maybe there will there will be delays
Speaker 4: and compared to the compared to the open CV renderer.
Speaker 4: But actually what is so is that with Scenic, which
Speaker 4: is a framework to create applications, uh desktop applications, and
Speaker 4: in Elixir with Phoenix sorry, with Cynic, I was able
Speaker 4: to receive the frames from UH from the Python process
Speaker 4: from open CV row as a binary and I was
Speaker 4: able to take this binary we die without doing any manipulation,
Speaker 4: any editing, any and using Scenic to render this frame
Speaker 4: directly into the window without any processing of the binary,
Speaker 4: which is was great. So yeah, I think this could work.
Speaker 4: Is still something I have to try. I think this
Speaker 4: could work well in a better device where we are
Speaker 4: running this object detection system and we actually want to
Speaker 4: see the result on another device. So we have our
Speaker 4: embedded device with the camera. It runs a scenic and
Speaker 4: the cool thing with scenic we are able to see
Speaker 4: remotely the result the window. So it's something I still
Speaker 4: have to try, but I think it should well.
Speaker 3: Nice. That is very cool.
Speaker 1: I love the idea that you can just like scene,
Speaker 1: it can just you know, display raw data coming in,
Speaker 1: don't have to process it and convert it in any way,
Speaker 1: and just kind of like be able to render it.
Speaker 3: So that is very cool.
Speaker 1: So awesome stuff that people can take advantage of and
Speaker 1: check out and look at. So if people are wanting
Speaker 1: to kind of get in touch with you and follow
Speaker 1: more about this topic, where should they go to do that?
Speaker 4: So the site where I where I write my blog
Speaker 4: posts is poit coding dot com and I write articles
Speaker 4: mainly about Elixir and Phoenix awesome.
Speaker 1: So we will also have links to that in the
Speaker 1: show notes. Check that out and also where you are
Speaker 1: on Twitter?
Speaker 2: Yes, your name?
Speaker 3: Well, let's go ahead and transition to picks. Sophie, do
Speaker 3: you have one you can share.
Speaker 5: Yeah, I do. So. I recently started going through this
Speaker 5: book called hold On, let me see.
Speaker 6: I can find it in our ex section black Hat Go.
Speaker 6: So I'm pretty new to GO when I'm starting to
Speaker 6: use it at work and just kind of plugging through
Speaker 6: and learning what I need to learn to kind of
Speaker 6: get stuff done in my actual job. So this has
Speaker 6: just been like a really fun read to go a
Speaker 6: little bit further and to sort of explore some of
Speaker 6: the things that GO can do and some of the
Speaker 6: things that we can learn about, you know, the Internet
Speaker 6: and how it works using this language and using these frameworks.
Speaker 5: I'm not super far into it yet.
Speaker 6: I'm only in chapter two, but for somebody that again
Speaker 6: is relatively new to Go, it's super approachable. It's been
Speaker 6: really cool. It's you know, it's very security oriented. You're
Speaker 6: kind of learning, you know, you're not really learning how
Speaker 6: to be a black cat attacker. That's not like a
Speaker 6: book that you're going to buy on Amazon. You know,
Speaker 6: you're learning to improve your offensive security skill set, which
Speaker 6: is always an area that I wanted to dive a little.
Speaker 5: Bit more into.
Speaker 6: So so far, it's been super fun and I'm definitely
Speaker 6: recommending it my other pick is not programming related. It
Speaker 6: is a reality show that is taking over the internet.
Speaker 6: You may have heard of Love is Blind, anyone.
Speaker 5: I'm going to try to keep it short because I
Speaker 5: am obsessed with it. The premise of.
Speaker 6: Love is Blind is that these people are dating each
Speaker 6: other in these pod like rooms where you cannot see
Speaker 6: the other person.
Speaker 5: There's like a frosted glass.
Speaker 6: Pane in between them, and the idea is that they
Speaker 6: want to get married. So as many proposals that come
Speaker 6: out of this dating situation, they're then allowed to meet.
Speaker 6: They're sent on like a vacation, they meet each other's families,
Speaker 6: they move in together, and then they see if they're.
Speaker 5: Going to actually get married. Their goal is to get married.
Speaker 6: And I started watching it because it sounds telling nuts
Speaker 6: and really fun, which it is. But it's also a
Speaker 6: really fascinating just like study of human behavior. I can't
Speaker 6: say enough good things about it. It's totally wild and
Speaker 6: I really recommend it to basically anyone.
Speaker 5: Please watch Love is Blind. You won't regret it.
Speaker 6: Oh when it's toasted by Nick Lache of ninety eight degrees,
Speaker 6: I should add, which.
Speaker 2: Is very important, very cool.
Speaker 1: I've heard about that one all right. So my pick
Speaker 1: is it's a it is a command line little tool
Speaker 1: that was created. It's to make it look like you're
Speaker 1: doing some really cool stuff on your computer.
Speaker 3: Right. It's it's just for show.
Speaker 1: It's actually called Hollywood, but it is it's actually been
Speaker 1: made appearances in television shows and movies and things. So like,
Speaker 1: if you want to look like super Elite, you know,
Speaker 1: you're going to have like your image detection going on
Speaker 1: on one screen with like as things are moving around
Speaker 1: being classified, and on the other screen you've got Hollywood going.
Speaker 1: And so you can check out the website. It's it's
Speaker 1: really cool because it you can actually run out of
Speaker 1: Docker and stuff like that, so you don't actually have
Speaker 1: to install anything. And but what it does is it
Speaker 1: opens up multiple t MUCKs panels with then it has
Speaker 1: lots of techno nonsense stuff going on, plus some real
Speaker 1: stuff like speed tests, directory tree listing, device listing, you know,
Speaker 1: off of your actual computer, you know, generating PGP keys,
Speaker 1: you know all stuff. It's all console based. It's just
Speaker 1: really fun, just just fun that I don't know. I
Speaker 1: think it's a cool little toy. But that's it for me, Alvisa,
Speaker 1: how about you?
Speaker 2: So uh.
Speaker 4: The I want to mention uh an article from Sasha
Speaker 4: Urick and uh the which is outside Elixir, which is
Speaker 4: an article that helped me a lot to see uh
Speaker 4: to to use parts uh and I think it's it's
Speaker 4: it's a really great read. And the the second thing
Speaker 4: is is a book. And actually this book is uh
Speaker 4: it's something I was reading. It's a fantastic book. One
Speaker 4: of the best books I read in the last two years.
Speaker 4: The name is designing that intensive applications and from the
Speaker 4: writer dealtor is Martin Klatman.
Speaker 3: Uh.
Speaker 1: Uh.
Speaker 4: It's a quite big book and it goes from the
Speaker 4: how database databases are written, how they store data in files, pages,
Speaker 4: how to use logs. And the reason why this isn't
Speaker 4: uh has been an important book to me is because
Speaker 4: I started a blog, my blog actually trying to implement
Speaker 4: something a database I log database that was explained in
Speaker 4: this book and I tried to do it in Elixir
Speaker 4: and it was so easy to do in Elixir that
Speaker 4: a Kivali store based on logs right ahead logs something simple.
Speaker 4: But it's actually one of the first articles. So uh,
Speaker 4: it's a great read.
Speaker 5: Uh.
Speaker 4: And also it deals he deals also with he explains
Speaker 4: the distributed databases all the issues how they also deal
Speaker 4: with the different tissues.
Speaker 2: Great.
Speaker 4: Great, And the last thing is uh, so I follow
Speaker 4: you guys on the on the on the movie side
Speaker 4: is something I watched recently. It's called Dark and is
Speaker 4: Uh time traveling is I think if if I remember
Speaker 4: Christly is.
Speaker 2: Uh is uh uh.
Speaker 4: Based in is Is in Deutschland, I think is uh
Speaker 4: and Uh. It's a great TV series about time traveling
Speaker 4: uh and the consequences of time traveling. And I'm really
Speaker 4: passionate about this topic and it's a great Yeah, it
Speaker 4: was great watch.
Speaker 3: Oh cool.
Speaker 1: All right, so I give a plus one to the
Speaker 1: Sashi Yericks article outside Alixer that is when I was
Speaker 1: getting into ports. That was like super helpful for me
Speaker 1: as well. So awesome good stuff there. All right, Well,
Speaker 1: thank you for coming on al Visa. I had a
Speaker 1: great time talking with you about this.
Speaker 4: And thanks a lot guys for having me.
Speaker 3: All right, glad you could come on. And that's it
Speaker 3: for today.
Speaker 1: Thank you for listening, and we hope you'll join us
Speaker 1: next time on Alixer Mix