投稿時間:2021-10-27 21:29:55 RSSフィード2021-10-27 21:00 分まとめ(35件)

カテゴリー等 サイト名等 記事タイトル・トレンドワード等 リンクURL 頻出ワード・要約等/検索ボリューム 登録日
python Pythonタグが付けられた新着投稿 - Qiita コンピュータとオセロ対戦21 ~データ分析~ https://qiita.com/tt_and_tk/items/db9c6d3e4893cfcbd679 次回は今回の考察でわかったように、一つの条件の中で評価値を求める方法はあまりよくないようなので、様々な相手と戦う方式で学習させてみます。 2021-10-27 20:51:32
python Pythonタグが付けられた新着投稿 - Qiita 米国株のポートフォリオをMatplotlibで視覚化 https://qiita.com/Lulu_die_Zweite/items/52ecd9d312eee963ead8 米国株のポートフォリオをMatplotlibで視覚化結論入力辞書型portfolioTSLAAAPLGOOGMSFTAMZN出力円グラフと最新価格のデータ、そして現在の合計資産円グラフのは保有金額ベースVariablecheckokayTSLAscurrentpriceAAPLscurrentpriceGOOGscurrentpriceMSFTscurrentpriceAMZNscurrentpriceYourcurrenttotalassetUSDollarsポートフォリオ情報の渡し方PortfoliotopiechartpyportfolioTSLAAAPLGOOGMSFTAMZN任意に書き換える下から行目を書き換える株のシンボルをkey持ってる数をvalueとして辞書型で渡す。 2021-10-27 20:30:26
python Pythonタグが付けられた新着投稿 - Qiita Python multiprocessing https://qiita.com/HAGEMON/items/f0f218cb19c43fbd8447 PythonmultiprocessingPythonmultiprocessingでCPU論理コア総動員で処理させる環境UbuntuLTSPythonmacOSMontereyPythonmultiprocessingはPythonに最初から入っているパッケージなので、別途install不要。 2021-10-27 20:13:51
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) rails サイト 作成 https://teratail.com/questions/366510?rss=all 2021-10-27 20:58:13
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) これまで正常だったssh鍵認証で接続ができなくなった https://teratail.com/questions/366509?rss=all また、別のサーバーに接続を試みた際はユーザーのパスワードの入力を求められssh鍵認証で入ることはできなくなっていました。 2021-10-27 20:37:43
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) Discord.js スラッシュコマンドを実装したい https://teratail.com/questions/366508?rss=all discordjs 2021-10-27 20:34:45
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) BeautifulSoup で 特定のタグ内のaタグのみを重複せずに1つ抽出したい https://teratail.com/questions/366507?rss=all BeautifulSoupで特定のタグ内のaタグのみを重複せずにつ抽出したい商品一覧ページそれぞれの個別ページに遷移してスクレイピングしたいと思っています。 2021-10-27 20:23:03
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) レコード同士のペアをどうモデリングするか【姉妹都市の関連のデータモデリング】 https://teratail.com/questions/366506?rss=all 2021-10-27 20:05:19
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) Mysql2::Error: Expression #1 of SELECT list is not in GROUP BY clause and contains nonaggregatedエラーの https://teratail.com/questions/366505?rss=all MysqlErrorExpressionofSELECTlistisnotinGROUPBYclauseandcontainsnonaggregatedエラーの起きている問題本番環境にデプロイしたところ、下記のエラーが出ます。 2021-10-27 20:03:56
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) JS IntersectionObserver https://teratail.com/questions/366504?rss=all 2021-10-27 20:01:16
Linux Ubuntuタグが付けられた新着投稿 - Qiita Python multiprocessing https://qiita.com/HAGEMON/items/f0f218cb19c43fbd8447 PythonmultiprocessingPythonmultiprocessingでCPU論理コア総動員で処理させる環境UbuntuLTSPythonmacOSMontereyPythonmultiprocessingはPythonに最初から入っているパッケージなので、別途install不要。 2021-10-27 20:13:51
Docker dockerタグが付けられた新着投稿 - Qiita 「ゼロからのOS自作入門」環境構築 https://qiita.com/O-Jun/items/7ff9f7e87bfa386b8685 私はもうビルドしてしまったので分からないが、Openfolderincontainerを選択すればビルドができるはずである。 2021-10-27 20:23:32
Ruby Railsタグが付けられた新着投稿 - Qiita Rails database.yml | MySQL PostgreSQL https://qiita.com/___fff_/items/aebba8903795d217be6f Rails database yml MySQL PostgreSQLRails database yml MySQL PostgreSQLdatabase yml Install the MYSQL driver gem install mysql Ensure the MySQL gem is defined in your Gemfile gem mysql And be sure to use new style password hashing development adapter mysql encoding utf reconnect false database sample mysql development pool username root password socket tmp mysql sock Warning The database defined as test will be erased and re generated from your development database when you run rake Do not set this db to the same as development or production test adapter mysql encoding utf reconnect false database sample mysql test pool username root password socket tmp mysql sockproduction adapter mysql encoding utf reconnect false database sample mysql production pool username root password socket tmp mysql sockdatabase yml PostgreSQL Versions and up are supported Install the pg driver gem install pg On Mac OS X with macports gem install pg with pg config opt local lib postgresql bin pg config On Windows gem install pg Choose the win build Install PostgreSQL and put its bin directory on your path Configure Using Gemfile gem pg development adapter postgresql encoding unicode database sample postgres development pool username root password Connect on a TCP socket Omitted by default since the client uses a domain socket that doesn t need configuration Windows does not have domain sockets so uncomment these lines host localhost port Schema search path The server defaults to user public schema search path myapp sharedapp public Minimum log levels in increasing order debug debug debug debug debug log notice warning error fatal and panic The server defaults to notice min messages warning Warning The database defined as test will be erased and re generated from your development database when you run rake Do not set this db to the same as development or production test adapter postgresql encoding unicode database sample postgres test pool username sample postgres password production adapter postgresql encoding unicode database sample postgres production pool username sample postgres password 2021-10-27 20:50:03
技術ブログ Developers.IO [CDK]AWS WorkSpacesへのログインを検知してSlack通知する https://dev.classmethod.jp/articles/cdk-aws-workspaces-slack/ cdkawsworkspaces 2021-10-27 11:56:45
海外TECH MakeUseOf The 9 Best Rugged Chromebook Cases https://www.makeuseof.com/tag/best-rugged-chromebook-cases/ chromebook 2021-10-27 11:27:55
海外TECH MakeUseOf T-Mobile Will Pay Off Your Phone If You Switch Networks: How the Offer Works https://www.makeuseof.com/tmobile-will-pay-off-your-phone-if-you-switch-networks/ T Mobile Will Pay Off Your Phone If You Switch Networks How the Offer WorksT Mobile has introduced a new offer that could make it a whole lot more attractive to switch carriers Here s what you need to know 2021-10-27 11:02:21
海外TECH DEV Community Building a Tailwind CSS file upload input component https://dev.to/themesberg/building-a-tailwind-css-file-upload-input-component-4he4 Building a Tailwind CSS file upload input componentTailwind CSS is a framework that I ve been using quite a lot lately and there s one particular problem that has been slowing my development process the lack of components Although I love the new way of building websites with the utility classes I do miss having a couple of web components to use right away when building new interfaces That is why I decided to start a tutorial series here on the DEV community where I show you how to build commonly used web components with the utility classes from Tailwind CSS Last time I showed you how to build checkbox and radio input fields and today I will show you how to build a nicely looking file upload input component with Tailwind CSS Let s get started Tailwind CSS file upload componentFirst things first we need to set up the HTML markup for the file upload input lt label for user avatar gt Upload file lt label gt lt input aria describedby user avatar help id user avatar type file gt lt div id user avatar help gt A profile picture is useful to confirm your are logged into your account lt div gt As you can see we already added the for and id attributes Let s add some styles to the label element lt label class text sm font medium text gray block mb for user avatar gt Upload file lt label gt lt input aria describedby user avatar help id user avatar type file gt lt div id user avatar help gt A profile picture is useful to confirm your are logged into your account lt div gt Looking better Now the important part we need to style the input itself Let s add some styles for that lt label class text sm font medium text gray block mb for user avatar gt Upload file lt label gt lt input class block w full cursor pointer bg gray border border gray text gray focus outline none focus border transparent text sm rounded lg aria describedby user avatar help id user avatar type file gt lt div id user avatar help gt A profile picture is useful to confirm your are logged into your account lt div gt Let s also add some style to the helper text below lt label class text sm font medium text gray block mb for user avatar gt Upload file lt label gt lt input class block w full cursor pointer bg gray border border gray text gray focus outline none focus border transparent text sm rounded lg aria describedby user avatar help id user avatar type file gt lt div class mt text sm text gray id user avatar help gt A profile picture is useful to confirm your are logged into your account lt div gt You may ask but it still doesn t look good Why is that The reason is because we still have to write some pseudo styles for the input file button Add the following styles in your CSS file which is configured for the Post CSS compilation input type file webkit file upload button input type file file selector button apply text white bg gray hover bg gray font medium text sm cursor pointer border py pl pr margin inline start rem margin inline end rem After you ve added this code the final HTML with the classes should look something like this Congratulations you ve build a file upload component using the utility classes from Tailwind CSS Before you go I would like to inform you that this Tailwind CSS file upload component is part of a larger and open source Tailwind CSS component library called Flowbite You can check out Flowbite and start making websites even faster with a set of commonly used web components such as buttons alers navigation bars modals and more using the utility classses from Tailwind CSS 2021-10-27 11:46:21
海外TECH DEV Community Skeletonise yourself with AI pose detection https://dev.to/jozefmaxted/skeletonise-yourself-with-ai-pose-detection-5c6a Skeletonise yourself with AI pose detectionThis post was originally written on the Pixelhop blog Skeletonise yourself with pose detectionWe recently built a fun halloween experiment where we use something called pose detection to skeletonise your body in realtime using your body You can try it out for yourself here Trick or Treat In this post we will show you how you can create something similar using TensorFlow js and pose detection models Take a look here to see what you will build What is pose detection What in the world is pose detection and why might I want to use it Well in simple terms it s the process of taking an image or video locating any bodies in the frame and then figuring out where their body parts are What is pose detection good for Well it will probably have loads of real world uses You could use it to create a Yoga app that detects when you are in the correct pose You could use it to analyse your running technique and provide feedback You could use it to create interactive art installations In our case we decided to test it out on probably the most important use case of all turning you into a skeleton of course Before we beginYou can find the finished code for this tutorial here We will be using Vite to bundle our project and run a dev server so start a new project with npm init vite latest skeletoniser template vanilla ts Starting the webcamSo before there s any chance of skeletonising happening we need something to skeletonise The first thing we need to do is grab the feed from a webcam to see the ghosts your body Creating HTML to display the webcam feedTo see the web cam we first need to add a HTML element that is capable of displaying it The lt video gt element is the perfect tool for the job Update your index html to contain a video element like below Delete the existing lt div id app gt lt div gt lt index html gt lt DOCTYPE html gt lt html lang en gt lt head gt lt meta charset UTF gt lt link rel icon type image svg xml href favicon svg gt lt meta name viewport content width device width initial scale gt lt title gt Vite App lt title gt lt head gt lt body gt lt video playsinline autoplay true width height gt lt script type module src src main ts gt lt script gt lt body gt lt html gt Let s quickly talk few the attributes we have added to the video element Firstly we have added playsinline This attribute tells mobile browsers that video should play inline on the page rather than their default behaviour of opening up in fullscreen The second attribute is autoplay true This one does what it says on the tin and means the video element will play automatically as soon as a video is available rather than being paused by default Now that we have a video element let us reference it to use it in our code later Modify src main ts to look like the following src main tsimport style css const videoEl document querySelector lt HTMLVideoElement gt video You might notice the after the querySelector call This tells Typescript that the video element will definitely exist so we don t need to account for the chance it could be missing in the code we write later Requesting access to the webcam and attaching to the video elementOur video element is all set up and we have a reference to it The next step is getting some media to play on it To do that we need to request a MediaStream src main tsasync function initCamera const stream await navigator mediaDevices getUserMedia video facingMode user width ideal height ideal audio false let onVideoReady ready boolean gt void const videoReadyPromise new Promise resolve gt onVideoReady resolve videoEl onloadedmetadata gt onVideoReady true videoEl srcObject stream return videoReadyPromise async function start await initCamera start When we call the initCamera function the user will be prompted to allow access to their webcam We pass an options object to the getUserMedia function Specifying the facingMode property in the video object lets the browser know that it should choose the camera facing the user if there are multiple cameras On mobile devices this should mean the selfie camera is selected by default We also specify width and height parameters This tells the browser the ideal dimensions of the video we want to receive In this case we have chosen to limit it to x if possible so that the pose detection will be efficient The bigger the video the more resource intensive the pose detection will be so x is a happy medium After getting the stream we can then assign it to the video element we created earlier Before we do that we make a new promise that will allow us to wait for the video to completely load before resolving After assigning a video a media stream it takes time to initialise everything and actually load the stream By adding an onloadmetadata event listener to the video element that resolves our promise we can ensure we don t use the video before it is ready Once all that s set up it s time to add the stream to the video by assigning it to the video element s srcObject property Hopefully by this point you should be seeing your face appearing on the page Drawing on top of the video with canvasDisplaying the webcam feed is excellent but we need to start thinking about manipulating and adding to it Our goal is to superimpose a skeleton on top of the feed so we need to draw images on top of it Canvas is the perfect tool for the job here We can add a new canvas element and position it precisely over the top of the video Modify index html to look like the following lt DOCTYPE html gt lt html lang en gt lt head gt lt meta charset UTF gt lt link rel icon type image svg xml href favicon svg gt lt meta name viewport content width device width initial scale gt lt title gt Vite App lt title gt lt head gt lt body gt lt div class container gt lt video playsinline autoplay true width height gt lt video gt lt canvas width height gt lt div gt lt script type module src src main ts gt lt script gt lt body gt lt html gt We have added a wrapper div around the video element This is so we can position the canvas element absolutely on top of the video To do that we need to add some css style css container position relative width px height px canvas position absolute top left width height Finally let s get a reference to the canvas element and get a rendering context so that we can use it later main tsconst videoEl document querySelector lt HTMLVideoElement gt video const canvasEl document querySelector lt HTMLCanvasElement gt canvas const ctx canvasEl getContext d async function initCamera const stream await navigator mediaDevices getUserMedia video facingMode user width ideal height ideal audio false let onVideoReady ready boolean gt void const videoReadyPromise new Promise resolve gt onVideoReady resolve videoEl onloadedmetadata gt onVideoReady true videoEl srcObject stream return videoReadyPromise async function start await initCamera start Pose detection with TensorFlow js and BlazePoseOk here comes the fun part Now that our webcam is up and running and we have a way to draw over the top of the video feed it s time to use AI to analyse the video feed and detect any poses skeletons within the video At this point your might be thinking Jozef I am just a lowly frontend developer Don t I need to be genius AI machine learning guru to be able to do pose detection That s very humble of you but don t put yourself down like that TensorFlow js make all of this very clever AI stuff extremely accessible to any frontend developer TensorFlow js is a library that enables machine learning within the browser There are loads of pre built models that can achieve all sorts of tasks from object detection to speech recognition and thankfully for us pose detection You can take a look at the available models here In addition to the pre built models you can train your own but let s save that for another article The TensorFlow js pose detections models can be found here As you can see they have models to choose from each of which has pros and cons We decided to go with BlazePose because we found it to have good performance and it provides additional tracking points that could be useful Let s install the TensorFlow js dependencies so we can use it in our project npm i tensorflow models pose detection tensorflow tfjs backend webgl tensorflow tfjs converter Note we have locked the TensorFlow dependencies to because there were issues with later versions Now that we have got TensforFlow js installed let s update src main ts to make use of the new packages and start pose detecting main tsimport as poseDetection from tensorflow models pose detection import tensorflow tfjs backend webgl import style css const videoEl document querySelector lt HTMLVideoElement gt video const canvasEl document querySelector lt HTMLCanvasElement gt canvas const ctx canvasEl getContext d async function initCamera const stream await navigator mediaDevices getUserMedia video facingMode user width ideal height ideal audio false let onVideoReady ready boolean gt void const videoReadyPromise new Promise resolve gt onVideoReady resolve videoEl onloadedmetadata gt onVideoReady true videoEl srcObject stream return videoReadyPromise async function initPoseDetection const model poseDetection SupportedModels BlazePose const detector await poseDetection createDetector model runtime tfjs modelType lite maxPoses as poseDetection BlazePoseTfjsModelConfig return detector async function start await initCamera const detector await initPoseDetection async function render const poses await detector estimatePoses videoEl console log poses requestAnimationFrame render start Let s talk through the changes here Firstly at the top of the file you can see the new imports We import the pose detection library and the WebGL backend for TensorFlow js This allows TensorFlow js to run on the graphics processor resulting in much faster performance than running on the CPU The next addition is the initPoseDetection function Here we chose BlazePose as a model of choice and then we instantiated a new detector using the BlazePose model When doing this we pass a config object allowing us to customise how the model will run We set the runtime attribute to tfjs This tells the detector to use TensorFlow js you can also use something called MediaPipe but the performance varies massively between browsers The model attribute is set to lite There are three types of BlazePose model to choose from lite full and heavy These change the quality of the detection model Lite has the least accurate detection but is the best performing whilst heavy has the best accuracy but is very performance intensive and full is somewhere in the middle We have chosen lite because we want this to work in real time and on weaker devices if possible In case you hadn t guessed maxPoses specifies how many poses the detector should search for But again for the sake of performance we are limiting it to one The start function has been updated to create our pose skeleton detector after the camera is initialised and we have also added a new render function We will detect the poses on each video frame and eventually draw them to the canvas For the time being we are just detecting the poses with the line const poses await detector estimatePoses videoEl How easy is that You just pass the estimatePoses function your video element a lot of AI magic happens in the background and before you know it you ll have a nice array of poses If you look in your console now you should see s steady stream of pose arrays logging into your console If you open one of them out and look inside it should look something a bit like this score keypoints x y z score name nose x y z score name left eye inner x y z score name left eye x y z score name left eye outer x y z score name right eye inner x y z score name right eye The top level score property is the confidence that a pose is actually in the frame After that we have keypoints These contain the coordinates of all the bits of your body Let s just stop a second and think about how amazing it is that you can get to this point entirely in the browser Not so long ago pose tracking like this would require one of those ridiculous bobble suits and a costly camera set up like you see when CGI scenes are being recorded at the movies Now you can get pretty good results with your selfie cam and Google Chrome Drawing the detected poseIt s about time we start putting all this clever AI to use and drawing our skeleton For a simple first step we will attempt the hello world of skeletonising and mark the components of our head using simple dots and lines To do this we can create a new Skeleton class that will handle the drawing of each body part For the time being we will only draw the head The start of our Skeleton class can be seen below Drawing the detected poseIt s about time we start putting all this clever AI to use and drawing our skeleton For a simple first step we will attempt the hello world of skeletonising and mark the components of our head using simple dots and lines To do this we can create a new Skeleton class that will handle the drawing of each body part For the time being we will only draw the head The start of our Skeleton class can be seen below src skeleton tsimport Pose from tensorflow models pose detection export class Skeleton constructor private ctx CanvasRenderingContextD private drawHead pose Pose const leftEye pose keypoints find keypoint gt keypoint name left eye const rightEye pose keypoints find keypoint gt keypoint name right eye const leftMouth pose keypoints find keypoint gt keypoint name mouth left const rightMouth pose keypoints find keypoint gt keypoint name mouth right const nose pose keypoints find keypoint gt keypoint name nose this ctx fillStyle red this ctx strokeStyle red this ctx lineWidth if leftEye this ctx beginPath this ctx arc leftEye x leftEye y Math PI this ctx fill if rightEye this ctx beginPath this ctx arc rightEye x rightEye y Math PI this ctx fill if nose this ctx beginPath this ctx arc nose x nose y Math PI this ctx fill if leftMouth amp amp rightMouth this ctx beginPath this ctx moveTo leftMouth x leftMouth y this ctx lineTo rightMouth x rightMouth y this ctx stroke public draw pose Pose this drawHead pose So here you can see we have a class with two methods When we instantiate a new Skeleton we will pass it to the canvas rendering context via the constructor This will allow the Skeleton to use it later so it can draw the skeleton parts Next we have the drawHead method As you have probably guessed this will be responsible for rendering the head Eventually we will have a function for each body part but the head is enough to get things started Each time the drawHead method is called we will pass it the current pose object from BlazePose At the beginning of the function we find each key point that makes up the head Once we have the key points we then go about drawing them For the eyes and nose we draw a simple circle at their coordinates For the mouth we draw a line between the left and right sides of the mouth We can now update main ts to create a new Skeleton and call its draw function on render main tsasync function start await initCamera const detector await initPoseDetection const skeleton new Skeleton ctx async function render const poses await detector estimatePoses videoEl maxPoses flipHorizontal false scoreThreshold ctx clearRect if poses skeleton draw poses requestAnimationFrame render render You should now have something that looks a bit like this The pose detection is working Of course the code we have just written to draw the head will be replaced but it s good to see visual proof that the pose detection is working as it should Mapping images to body partsSo as you can see drawing dots and lines over the pose key points is very easy Unfortunately dots and lines make a pretty awful Halloween costume so replacing them with illustrated skeleton pieces would be better We got a skeleton illustration and separated all the body parts and exported them individual from Figma Here is our skeleton To map an image to the correct position there are a few things we need to work out The position of the image It s x and y coordinates The angle of the image Do we need to rotate it to fit correctly The height and width Do we need to scale it horizontally or vertically For the head we can use the nose keypoint as the central coordinates To figure out the rotation we can calculate the angle between the two eye key points Finally to figure out the horizontal scale we can calculate the distance between the eyes and then compare it to the actual distance between the eyes in our head image We can do the same for the horizontal scale by measuring the height between the mouth and the eyes All of the above can be worked out using Vector math We have created a small helper file to do this src vectors tsexport interface Vector x number y number Find the middle point between two vectors export function getMiddle a Vector b Vector Vector return x a x b x a x y a y b y a y Find the distance between two vectors param a param b export function getDistance a Vector b Vector number const x a x b x const y a y b y return Math sqrt x x y y Get the angle in degrees between two vectors param a param b export function getAngle a Vector b Vector return Math atan b y a y b x a x Math PI Our vector helper file can now be used in the Skeleton draw functions to figure out the image positioning import Pose from tensorflow models pose detection import getAngle getDistance getMiddle from vectors Skeleton partsimport Head from assets skeleton Head png Load the skeleton partsconst head new Image head src Head export class Skeleton constructor private ctx CanvasRenderingContextD private drawHead pose Pose const leftEye pose keypoints find keypoint gt keypoint name left eye const rightEye pose keypoints find keypoint gt keypoint name right eye const leftMouth pose keypoints find keypoint gt keypoint name mouth left const rightMouth pose keypoints find keypoint gt keypoint name mouth right const nose pose keypoints find keypoint gt keypoint name nose The real dimensions of keypoints in our head image const eyeWidth const eyesToMouth If we are missing any parts return early if leftEye rightEye leftMouth rightMouth nose return const eyeAngleDeg getAngle leftEye rightEye const distance getDistance leftEye rightEye const xScale distance eyeWidth const middleEye getMiddle leftEye rightEye const middleMouth getMiddle leftMouth rightMouth const mouthToEyeDistance getDistance middleEye middleMouth const yScale mouthToEyeDistance eyesToMouth this drawImage image head x nose x y nose y height head height yScale width head width xScale rotation eyeAngleDeg offsetX offsetY private drawImage options image HTMLImageElement x number y number height number width number rotation number offsetX number offsetY number void const image x y height width rotation offsetX offsetY options save the unrotated context of the canvas so we can restore it later the alternative is to untranslate amp unrotate after drawing this ctx save move to the center of the canvas this ctx translate x y rotate the canvas to the specified degrees this ctx rotate rotation Math PI draw the image since the ctx is rotated the image will be rotated also this ctx drawImage image width offsetX height offsetY width height we re done with the rotating so restore the unrotated ctx this ctx restore public draw pose Pose this drawHead pose There s quite a lot of changes here so let s go through them Starting at the top of the file we import our shiny new vector helpers We also import the image that will be used for our head and create a new Image and set its src This will allow us to draw it to the canvas with drawImage later import getAngle getDistance getMiddle from vectors Skeleton partsimport Head from assets skeleton Head png Load the skeleton partsconst head new Image head src Head Moving on to the drawHead function private drawHead pose Pose const leftEye pose keypoints find keypoint gt keypoint name left eye const rightEye pose keypoints find keypoint gt keypoint name right eye const leftMouth pose keypoints find keypoint gt keypoint name mouth left const rightMouth pose keypoints find keypoint gt keypoint name mouth right const nose pose keypoints find keypoint gt keypoint name nose The real dimensions of keypoints in our head image const eyeWidth const eyesToMouth If we are missing any parts return early if leftEye rightEye leftMouth rightMouth nose return const eyeAngleDeg getAngle leftEye rightEye const distance getDistance leftEye rightEye const xScale distance eyeWidth const middleEye getMiddle leftEye rightEye const middleMouth getMiddle leftMouth rightMouth const mouthToEyeDistance getDistance middleEye middleMouth const yScale mouthToEyeDistance eyesToMouth this drawImage image head x nose x y nose y height head height yScale width head width xScale rotation eyeAngleDeg offsetX offsetY Here you can see we have gotten rid of the quick dot line drawing and replaced it with a lot of maths We have two constants for the eye width and the eye to mouth height These are the actual pixel distance between the eyes and the eyes to mouth in Head png and we can use these to scale our image relative to the lengths in the detected pose We work out the rotation for the head image by getting the angle between the two eye keypoints const eyeAngleDeg getAngle leftEye rightEye The x axis scale is worked out by measuring the distance between the two eye key points and then dividing it by the real pixel width const distance getDistance leftEye rightEye const xScale distance eyeWidth We can then do something similar to figure out the y axis scale const middleEye getMiddle leftEye rightEye const middleMouth getMiddle leftMouth rightMouth const mouthToEyeDistance getDistance middleEye middleMouth const yScale mouthToEyeDistance eyesToMouth The only difference here is that we find the middle point between the eyes and the central point between both sides of the mouth and then calculate the height Now that all the maths is done its time to draw the head image to the canvas this drawImage image head x nose x y nose y height head height yScale width head width xScale rotation eyeAngleDeg offsetX offsetY We are using another new function on the Skeleton class here called drawImage which we will talk about in a bit Still for the time being you can see that we are using the variables we calculated above to position scale and rotate the image correctly Now back to the Skeleton s drawImage function private drawImage options image HTMLImageElement x number y number height number width number rotation number offsetX number offsetY number void const image x y height width rotation offsetX offsetY options save the unrotated context of the canvas so we can restore it later this ctx save move to the center of the canvas this ctx translate x y rotate the canvas to the specified angle this ctx rotate rotation Math PI draw the image because ctx is rotated the image will be rotated also this ctx drawImage image width offsetX height offsetY width height restore the unrotated ctx this ctx restore This function allows us to draw an image and rotate it around an anchor point of our choosing By default the canvas drawImage function will position an image from its top left coordinate Unfortunately this makes it awkward for us to position and rotate the image to match the pose Using the canvas translate and rotate functions before drawing the image allows us to position it and rotate how we need to Hopefully by this point you are starting to look a bit sillier like I am below Where s my body We ve got a lovely looking skeleton skull but we are still missing a lot of bones Luckily we now have everything in place to draw the rest of the body We need to create draw functions for each of the other body parts I won t copy all the draw functions here because there are loads of them but if you want to see them all check them out on the repo Happy Halloween We hope you enjoyed this post and have been able to adequately skeletonise yourself as a result We love projects that are a bit of fun like this and can t wait to keep experimenting As always if you enjoyed this post or have any questions feel free to reach out to us on Twitter pixelhopio or subscribe to our newsletter to be kept up to date with what ever crazy things we build next 2021-10-27 11:24:20
海外TECH DEV Community Move from one page to another without loading https://dev.to/clementgaudiniere/move-from-one-page-to-another-without-loading-jlb move 2021-10-27 11:20:42
海外TECH DEV Community Introduction to Scaling https://dev.to/abh1navv/introduction-to-scaling-1mcj Introduction to ScalingScalability is one of the top concerns when it comes to designing software systems Applications are generally created with the objective that someday there will be a large number of users using them However the initial application does not need to support a large number of users It needs to expand when necessary but overall keep the cost low as long as it can Let s analyze what is scaling and what are the two different ways to implement it when required Definition Scalability is the measure of a system s ability to increase or decrease in performance and cost in response to changes in application and system processing demands GartnerLet s reiterate the keywords Ability As stated earlier does not have to be super strong at the beginning but should be able to evolve when needed Increase or decrease Upwards isn t the only direction To optimize the cost it needs to shrink too otherwise we will be spending more on resources and reducing our profits In response to changes in demand Demand can be divided into two parts It s not only the users that can increase but we also want to occasionally add features The application needs to monitor the impact of user feature changes and scale accordingly whether automatically or through manual intervention Types of scalingImagine that the house the resource you re living in was turning out to be smaller for your needs People users in the house increase as life goes on and furnitures features increase too as the standard of living goes up Now you want to expand your house for comfort There are typically two options UpwardsYou decide to create another floor above your house and it solves the issue This is called Vertical Scaling The users and features remained at the same location but they had a bigger resource supporting it This is typically equal to adding more physical resources CPU Storage Network upgrages to an existing server so that it can perform well against increase in demand However you cannot keep creating another floor every time you need to expand Someday the strength of the house will become a limitation In the same way the limit to which physical resources can be increased is also fixed Lets look at another way to tackle this problem OutwardsYou decide to buy create another apartment and some of your family members and their things can shift into it This is called Horizontal scaling You increase the resources so that the all the load does not come to one resource This is achieved by adding servers with similar capabilities and a load balancer which divides the user requests among servers Now the problem and limitations that we had with vertical scaling is removed in horizontal scaling we can buy as many apartments as we need assuming that the apartments are available but not overthinking it further As much as horizontal scaling looks better and efficient in long term it is not always the easier and certainly not the cheaper option between the two types of scaling We will compare the two options but before that let s understand what is being scaled here What are we scaling An application is generally created using multiple software components We talk about tiered architectures Most of the applications are created using some variation of tier or N tier architectures If you want to learn revise these architectures check out this thread by Jon Jackson Jon Jackson iamjonjackson An Introduction to N tier Systems and Distributed Apps A thread PM Oct So from the N tier architecture we know that there will be multiple backend components supporting the application They will be divided into tiers and each tier will be physically isolated from the other tiers Scaling can be applied to each physical tier separately Each tier can be scaled in its own way and the entire application can have a mix and match of components with different scaling capabilities Note You may have heard about Microservices architecture For all practical purposes a single microservice is an application in itself and has a N tier architecture of its own Just like a slice of Pizza is a Pizza itself and contains the same layers Vertical vs Horizontal scalingBelow is a comparison of vertical and horizontal scaling based on few desirable parameters Advantages of horizontal scalingNo Hardware LimitationsHorizontal scaling has no hardware limitations at all and it is possible to scale to as many servers as required While vertical scaling has an upper limit Deployment Downtimes Having one server means that deployment downtimes are likely Deployment downtimes can be minimized in a vertical system which has a backup server only used during deployments However in a horizontal system the downtimes can practically be reduced to zero Code can be deployed to servers in batches and they can be taken offline during the deployment while other servers take the load Fault tolerance It is the ability of a system to continue working sometimes with reduced performance when one or more of its components fail Here too horizontal systems perform better If one server fails only a part of the system s capacity is lost and it can still remain fully functional There may be some reduction in performance till the fault is resolved In a vertical system it fails miserably and needs immediate repair Advantages of vertical scalingInitial Cost For initial costs vertical scaling looks cost effective You only use what you absolutely need Moreover you save a lot of money on other infrastructure network virtualization technology load balancers and sometimes people administrators Cost comparison isn t very straightforward in the vertical vs horizontal battle If availability of a system is a concern and results in loss of revenue the vertical systems do not turn out to be cost effective Maintenance Multiple servers are harder to maintain Additional complexity is added when load balancers are added Deployment strategies need to be created and followed Miscellaneous adviceDesign with the intent that the application has to grow eventually Design your application to be easily replicable from one server to another when the need arises Containerization and serverless solutions can make horizontal scaling cheaper Start with cloud solutions unless you already own private infrastructure Scaling has to be maintained at every backend tier Think about each component Database servers have to scale too and not just the application I hope this gives an insight into the need for scaling and the two different types of scaling Stay tuned for the further articles where we will discuss about scaling in terms of Monitoring applications to recognize the need to scale An introduction to containerization and how it helps in deploying applications across multiple servers Setting up auto scaling with Azure App Service If you want to connect with me I am available on Twitter DMs are open on DEV as well as Twitter 2021-10-27 11:13:15
Apple AppleInsider - Frontpage News MacBook Pro shipping delays caused by UPS 'mechanical' problems https://appleinsider.com/articles/21/10/27/macbook-pro-shipping-delays-caused-by-ups-mechanical-problems?utm_medium=rss MacBook Pro shipping delays caused by UPS x mechanical x problemsUPS has reportedly been updating some MacBook Pro buyers saying the unexpected delays to their orders were caused by unspecified mechanical failures Apple relies heavily on air freight here with iPhone Source AppleA number of people expecting to receive their new MacBook Pro on their first day of availability October instead just got emailed about delays In each case the emails contained a new delivery date in December but no further details Read more 2021-10-27 11:27:33
Apple AppleInsider - Frontpage News Russia launches new Apple App Store antitrust investigation https://appleinsider.com/articles/21/10/27/russia-launches-apple-antitrust-investigation?utm_medium=rss Russia launches new Apple App Store antitrust investigationRussia is the latest country to begin an antitrust investigation into Apple s App Store this one following Apple s alleged ignoring of previous warnings Russia s Federal Antimonopoly ServiceRussia s Federal Antimonopoly Service has already been investigating Apple over antitrust issues to do with parental monitoring apps and has fined the company Separately the FAS says it has warned Apple about abusing its dominant position and now having ignored those warnings Russia will pursue a new case Read more 2021-10-27 11:31:43
海外TECH Engadget The Morning After: Best Buy and Home Depot pull several Chinese-made security cameras https://www.engadget.com/the-morning-after-best-buy-and-home-depot-pull-several-chinese-made-security-cameras-112055295.html?src=rss The Morning After Best Buy and Home Depot pull several Chinese made security camerasTwo US China stories seemed to occur independently of each other yesterday First up Best Buy and Home Depot pulled security cameras made by some Chinese companies linked to Uyghur surveillance Both US retail giants have stopped selling products from Lorex and Ezviz while Lowe s no longer carries products by the former The US government added parent companies Dahua and Hikvision to its economic blacklist in for their role in the mass surveillance of Uyghur Muslims in the province of Xinjiang Human rights groups believe over a million Uyghurs are being detained in internment camps but China continues to deny the allegations Home Depot told TechCrunch that it s quot committed to upholding the highest standards of ethical sourcing and it immediately stopped selling products from Lorex when this was brought to the company s attention quot Within the same hours the FCC then revoked China Telecom s ability to operate in the US Following proceedings that involved the Justice Department the FCC found that China Telecom was likely to comply with requests from the Chinese government and the commission believes there is the chance of the country affecting and disrupting US communications “Promoting national security is an integral part of the Commission s responsibility to advance the public interest the FCC said in a statement This follows the commission s actions regarding networking infrastructure from Huawei and ZTE two companies that bore the brunt of accusations of being threats to national security The one time Huawei subsidiary phone maker Honor is still waiting to see if it s going to be labeled similarly Officials at four federal agencies voted last month whether to place the company on the Commerce Department s entity list It was a tie China Telecom has days to comply with the order Mat SmithAdobe brings Photoshop and Illustrator to the webYou ll be able to do basic edits and collaborate with others Adobe has announced quot a major step forward for collaboration quot by bringing its Photoshop and Illustrator apps to the web though it s pretty limited to start with The idea is not to let you do complex work from a web page but to allow collaborators to open and view your work from a browser to provide comments and feedback Think of it as Google Docs but for graphics You should be able to review and add comments to files without needing to have a Creative Cloud account Continue reading Kindle Paperwhite Signature Edition reviewThis is the best e reader EngadgetThe Kindle Paperwhite improves on its predecessor in a number of key ways most significantly its larger and more responsive display The Signature Edition also adds a few “nice to have features like wireless charging and more storage space but the standard Kindle Paperwhite remains the e reader for most people ーthis edition is expensive Continue reading Dune Part Two arrives October th Unlikely to be a streaming debut however DuneLegendary Pictures has confirmed plans to release Dune Part Two saying it was quot excited to continue the journey quot The studio expects the movie to premiere October th The first movie only covered half of Frank Herbert s sci fi classic Continue reading Niantic s Pikmin Bloom mobile game starts rolling outReady for a new obsession NianticThe creators of Pokémon Go have begun to roll out Pikmin Bloom worldwide starting with Singapore and Australia Similar to Pokémon Go you ll have to go out and interact with the real world to enjoy the game However it s likely to be a little more chill Niantic CEO John Hanke said in the game s video announcement that the flowers the Pikmin make can be viewed by other players so you can create shared gardens with your neighbors Oh and there are no battles Pikmin is another iconic gaming franchise from Nintendo but the appeal is likely to be a little limited in comparison to Pokémon Continue reading Artists can bake verification into their NFTs using PhotoshopBuyers will know digital art is authentic In further proof that NFTs are going nowhere Adobe is updating Photoshop with a beta Content Credentials feature that helps to establish the authenticity of NFTs Once artists link their crypto wallets and social media accounts to Content Credentials buyers can check that the wallet used to produce artwork is the same wallet that minted it Beyond NFTs an opt in Photoshop feature attaches edits and identity info to images adding transparency and should allay some concerns about deception Continue reading The biggest news stories you might have missedOura s updated smart ring has continuous heart rate trackingVolvo s C Recharge adds fastback style to the XCMaster amp Dynamic put its headphone expertise into a gaming headsetFCC revokes China Telecom s ability to offer services in the USPalm pivots to audio for some reason with ANC true wireless earbudsYubico s latest security offers USB C and NFC authentication for 2021-10-27 11:20:55
海外TECH Engadget Google now lets users ask for images of minors to be removed from Search https://www.engadget.com/googles-under-18-image-search-removal-option-is-now-widely-available-110634356.html?src=rss Google now lets users ask for images of minors to be removed from SearchGoogle has activated a safety feature that lets minors under request that images of themselves be removed from search results The Verge has reported Google first announced the option back in August as part of a slate of new safety measures for kids but it s now rolling out widely to users nbsp Google said it will remove any images of minors quot with the exception of case of compelling public interest or newsworthiness quot The requests can be made by minors their parents guardians or other legal representatives nbsp To do so you ll need to supply the URLs you want removed the name and age of the minor and the name of the person acting on their behalf Google notes that quot web URLs pages with both text and images are not eligible for removal under this policy which seeks to limit the presence of images in Google search results quot nbsp To that end it also can t remove images from websites hosting them so quot you might nbsp wish to contact the site s webmaster and ask them to remove the content quot Google said To aid in that it linked a guide on how to contact a site s webmaster nbsp Until Google starts to actively remove images we won t see what criteria it applies for quot public interest or newsworthiness quot In general though it seems like most images will likely get pulled if a minor or their guardian asks However it doesn t appear that you ll be able to demand the removal of images of yourself below unless you re currently under that age as The Verge has noted nbsp 2021-10-27 11:06:34
ラズパイ Raspberry Pi Computer science education is a global challenge https://www.raspberrypi.org/blog/brookings-report-global-computer-science-education-policy/ Computer science education is a global challengeFor the last two years I ve been one of the advisors to the Center for Universal Education at the Brookings Institution a US based think tank on their project to survey formal computing education systems across the world The resulting education policy report Building skills for life How to expand and improve computer science education around The post Computer science education is a global challenge appeared first on Raspberry Pi 2021-10-27 11:49:24
海外TECH CodeProject Latest Articles News Track - News Aggregator https://www.codeproject.com/Articles/5299293/News-Track-News-Aggregator certain 2021-10-27 11:27:00
海外科学 NYT > Science Merck Will Share Formula for its Covid Pill With Poor Countries https://www.nytimes.com/2021/10/27/health/covid-pill-access-molnupiravir.html molnupiravir 2021-10-27 11:45:37
ニュース BBC News - Home Man charged with murder after death of two boys in Brentwood https://www.bbc.co.uk/news/uk-england-essex-59061458?at_medium=RSS&at_campaign=KARANGA brentwood 2021-10-27 11:06:48
ニュース BBC News - Home Insulate Britain: Protesters block roads leading to M25 https://www.bbc.co.uk/news/uk-england-london-59061509?at_medium=RSS&at_campaign=KARANGA endless 2021-10-27 11:14:38
ニュース BBC News - Home Wage rises will put 30p on a pint, says pub chain https://www.bbc.co.uk/news/business-59001720?at_medium=RSS&at_campaign=KARANGA minimum 2021-10-27 11:21:06
ニュース BBC News - Home Paris attacks: UK Bataclan victim's sister tells accused 'we don't hate you' https://www.bbc.co.uk/news/world-europe-59062002?at_medium=RSS&at_campaign=KARANGA alexander 2021-10-27 11:29:11
ニュース BBC News - Home Wrexham 'buzzing' as owners Reynolds and McElhenney watch game https://www.bbc.co.uk/news/uk-wales-59061538?at_medium=RSS&at_campaign=KARANGA wrexham 2021-10-27 11:06:55
ニュース BBC News - Home More Australian Open doubt for unvaccinated players https://www.bbc.co.uk/sport/tennis/59062787?at_medium=RSS&at_campaign=KARANGA More Australian Open doubt for unvaccinated playersDoubts have been raised whether unvaccinated players will be allowed to take part in the Australian Open after contradictory statements from key politicians 2021-10-27 11:15:42
LifeHuck ライフハッカー[日本版] Kindle本2万冊が最大70%オフに!Kindle本ストア9周年キャンペーン【10/28まで】 https://www.lifehacker.jp/2021/10/244887kindle-sale-2110.html kindle 2021-10-27 21:00:00
北海道 北海道新聞 うつ病と自殺、関係認めず トヨタ販売店巡る山形地裁の和解 https://www.hokkaido-np.co.jp/article/604975/ 山形地裁 2021-10-27 20:01:00

コメント

このブログの人気の投稿

投稿時間:2021-06-17 22:08:45 RSSフィード2021-06-17 22:00 分まとめ(2089件)

投稿時間:2021-06-20 02:06:12 RSSフィード2021-06-20 02:00 分まとめ(3871件)

投稿時間:2021-06-17 05:05:34 RSSフィード2021-06-17 05:00 分まとめ(1274件)