머신러닝 이미지 분류 플젝(1)

seonghyeon·2022년 1월 13일
0

철권 캐릭터마다마다를 분류하는 모델로 사용자의 얼굴사진을 받아서
가장 닮은 캐릭터를 찾아주는 프로그램을 구현하기로했다

상세기능은 마무리 쯤 되어서 정리해서 올려볼생각이다

일단은 캐릭터 별 승률과 오메가(롤에서 챌린저)의 픽비율과 전체 픽 순위
스토리,콤보 영상링크,스타일을 가진 json 파일같은것들이없어서
승률 정보가있는 엑셀파일을 구해서 나머지를 추가한뒤 json형식으로 변환하여
DB에 저장하는 작업을 했다

http://shancarter.github.io/mr-data-converter/
엑셀파일을 json형식으로 전환시켜주는 사이트

그리고 이미지인식을위해서 페이지에 카메라기능을 추가하였다
이후 파일을 받는작업도해야겠지만 분명히 인식만하고 파일은안받는형식이있을법한데
좀더 알아봐야겟다 (머신러닝 재미읍다)

html에서 동영상과 동영상캡처를 이용한 사진 촬영 기능

<video id="player"autoplay></video>
    <button id="capture">Capture</button>
    <canvas id="canvas" width=320 height=240></canvas> <<<<<< 얘ㅋ
    <script>
      const player = document.getElementById('player');
      const canvas = document.getElementById('canvas');
      const context = canvas.getContext('2d');
      const captureButton = document.getElementById('capture');
    
      const constraints = {
        video: true,
      };
    
      captureButton.addEventListener('click', () => {
        // Draw the video frame to the canvas.
        context.drawImage(player, 0, 0, canvas.width, canvas.height);
      });
    
      // Attach the video stream to the video element and autoplay.
      navigator.mediaDevices.getUserMedia(constraints)
        .then((stream) => {
          player.srcObject = stream;
        });
    </script>

유저의 사진이 폴더에 누적이된다는것은 개인정보에 매우치명적이라고생각하여
결과값을 받음과동시에 삭제하는 구조를 가지게 하였다

파이썬 폴더내의 모든파일 삭제하는 함수

def DeleteAllFiles(Path):
    if os.path.exists(Path):
        for file in os.scandir(Path):
            os.remove(file.path)

이후 해야할것

캡처한 사진을 받아서 img폴더에 저장한다
그리고 뭐 여러가지들

0개의 댓글