55,000원
다른 수강생들이 자주 물어보는 질문이 궁금하신가요?
- 미해결딥러닝 웹서비스 프로젝트 1 - 기본편. Object Detect 불량품 판별
코드 다운로드
어디서 코드를 다운로드 받을 수 있나요?강의 하단 링크가 연결이 안되고, creapple.com 사이트 하단의 링크도 연결이 안됩니다.
- 미해결딥러닝 웹서비스 프로젝트 1 - 기본편. Object Detect 불량품 판별
다른 모델을 웹페이지에 적용
강의에서는 YOLOv3로 불량사과를 객체 인식을 하셨는데 혹시 YOLOv5로 웹페이지 만드는 방법이 없을까요?? 플라스크로 YOLOv5를 적용하여 객체 인식한 사진을 시각화하려고 합니다.
- 미해결딥러닝 웹서비스 프로젝트 1 - 기본편. Object Detect 불량품 판별
동시 요청
앱엔진에 동시에 여러 요청이 있을 경우 어떻게 처리할 수 있나요?
- 미해결딥러닝 웹서비스 프로젝트 1 - 기본편. Object Detect 불량품 판별
from flask import Flask, request, Resopnse, jsonify 여기서 에러가 나와요..!
위와 같은 사진 형태로 오류가 나오는데 어떻게 해결해야하나요??
- 미해결딥러닝 웹서비스 프로젝트 1 - 기본편. Object Detect 불량품 판별
밑에 분들하고 비슷한 에러네요...
아이오닉 웹앱 클라이언트 챕터에서 웹앱 웹서비스 테스트를 수행하고 있는데요. 아이오닉 로컬호스트에서는 실행이 잘되는데, 플라스크 실행해서 플라스크 서버를 들어가면 문제가 생깁니다. 크롬으로 플라스크 서버 192.168.0.10:5000을 입력해서 들어가면, (저는 이상하게 0.0.0.0으로 app run을 해도 192.168.0.10:5000으로 호스트가 뜹니다.) Method Not Allowed The method is not allowed for the requested URL. 이런 메세지가 나오구요. @app.route('/dnn/yolo', methods=['POST']) 위 코드를 @app.route('/dnn/yolo', methods=['GET', 'POST']) 으로 바꾸면, key error 'model'이 나오는데요... 뭔가 틀렸나싶어 예제코드를 아무리 붙여봐도 안되는데.ㅠㅠ 뭐가 잘못되었는지를 모르겠습니다... flask 버전을 1.1.1로 바꿔도 안되고... 브라우저를 웨일이나 인터넷익스플로러로 해도 안되고... 몇시간째 헤매고 있네요..ㅠ key error 모델에러는 다음과 같이 나구요.. werkzeug.exceptions.BadRequestKeyError werkzeug.exceptions.BadRequestKeyError: 400 Bad Request: The browser (or proxy) sent a request that this server could not understand. KeyError: 'model' Traceback (most recent call last) File "D:\web-dnn\Lib\site-packages\flask\app.py", line 2463, in __call__ return self.wsgi_app(environ, start_response) File "D:\web-dnn\Lib\site-packages\flask\app.py", line 2449, in wsgi_app response = self.handle_exception(e) File "D:\web-dnn\Lib\site-packages\flask_cors\extension.py", line 165, in wrapped_function return cors_after_request(app.make_response(f(*args, **kwargs))) File "D:\web-dnn\Lib\site-packages\flask\app.py", line 1866, in handle_exception reraise(exc_type, exc_value, tb) File "D:\web-dnn\Lib\site-packages\flask\_compat.py", line 39, in reraise raise value File "D:\web-dnn\Lib\site-packages\flask\app.py", line 2446, in wsgi_app response = self.full_dispatch_request() File "D:\web-dnn\Lib\site-packages\flask\app.py", line 1951, in full_dispatch_request rv = self.handle_user_exception(e) File "D:\web-dnn\Lib\site-packages\flask_cors\extension.py", line 165, in wrapped_function return cors_after_request(app.make_response(f(*args, **kwargs))) File "D:\web-dnn\Lib\site-packages\flask\app.py", line 1820, in handle_user_exception reraise(exc_type, exc_value, tb) File "D:\web-dnn\Lib\site-packages\flask\_compat.py", line 39, in reraise raise value File "D:\web-dnn\Lib\site-packages\flask\app.py", line 1949, in full_dispatch_request rv = self.dispatch_request() File "D:\web-dnn\Lib\site-packages\flask\app.py", line 1935, in dispatch_request return self.view_functions[rule.endpoint](**req.view_args) File "D:\web-yolo\flask\main.py", line 18, in main model = request.form['model'] File "D:\web-dnn\Lib\site-packages\werkzeug\datastructures.py", line 377, in __getitem__ raise exceptions.BadRequestKeyError(key) werkzeug.exceptions.BadRequestKeyError: 400 Bad Request: The browser (or proxy) sent a request that this server could not understand. KeyError: 'model' The debugger caught an exception in your WSGI application. You can now look at the traceback which led to the error. To switch between the interactive traceback and the plaintext one, you can click on the "Traceback" headline. From the text traceback you can also create a paste of it. For code execution mouse-over the frame you want to debug and click on the console icon on the right side. You can execute arbitrary Python code in the stack frames and there are some extra helpers available for introspection: dump() shows all variables in the frame dump(obj) dumps all that's known about the object 아래는 flask main.py 코드입니다. from flask import Flask, request, Response, jsonify import base64 from flask_cors import CORS import numpy as np import cv2 from PIL import Image from io import BytesIO confthres=0.5 nmsthres=0.1 app = Flask(__name__) CORS(app) @app.route('/dnn/yolo', methods=['GET', 'POST']) def main(): model = request.form['model'] if model == 'apple': labelsPath="./model/classes.names" configpath="./model/apple-train-yolo.cfg" weightspath="./model/apple-train-yolo_final.weights" else: labelsPath="./model/coco.names" configpath="./model/yolov3.cfg" weightspath="./model/yolov3.weights" print("[INFO] loading ", model.upper(), " models...") LABELS = open(labelsPath).read().strip().split("\n") net = cv2.dnn.readNetFromDarknet(configpath, weightspath) file = request.form['image'] starter = file.find(',') image_data = file[starter+1:] image_data = bytes(image_data, encoding="ascii") img = Image.open(BytesIO(base64.b64decode(image_data))) #img = cv2.imread('./dog.jpg') npimg=np.array(img) image=npimg.copy() image=cv2.cvtColor(image,cv2.COLOR_BGR2RGB) (H, W) = image.shape[:2] ln = net.getLayerNames() ln = [ln[i[0] - 1] for i in net.getUnconnectedOutLayers()] blob = cv2.dnn.blobFromImage(image, 1 / 255.0, (416, 416), swapRB=True, crop=False) net.setInput(blob) layerOutputs = net.forward(ln) boxes = [] confidences = [] classes = [] results = [] for output in layerOutputs: for detection in output: scores = detection[5:] classID = np.argmax(scores) confidence = scores[classID] if confidence > confthres: box = detection[0:4] * np.array([W, H, W, H]) (centerX, centerY, width, height) = box.astype("int") x = int(centerX - (width / 2)) y = int(centerY - (height / 2)) boxes.append([x, y, int(width), int(height)]) confidences.append(float(confidence)) classes.append({ 'id': int(classID), 'name': LABELS[classID] }) idxs = cv2.dnn.NMSBoxes(boxes, confidences, confthres, nmsthres) if len(idxs) > 0: for i in idxs.flatten(): results.append({ 'class': classes[i], 'confidence': confidences[i], 'bbox': boxes[i] }) return jsonify(results) # start flask app if __name__ == '__main__': app.run(debug=True, host='0.0.0.0')
- 미해결딥러닝 웹서비스 프로젝트 1 - 기본편. Object Detect 불량품 판별
에러 뜨면서 안되는데 어떻게 해야할까요
Method Not Allowed The method is not allowed for the requested URL. 이 에러가 뜨면서 안되는데요.. 이것저것 검색해서 찾아봤는데 해결이 안되네요..
- 미해결딥러닝 웹서비스 프로젝트 1 - 기본편. Object Detect 불량품 판별
바운딩박스 조정
바운딩박스를 그릴 때 인식한 개체의 좌표값으로 찍어야하는데 화면 크기에 따라 인식한 좌표들이 상대적으로 변하는게 아니라 특정 위치에 찍히도록 고정되어있는 것 같은데 화면 사이즈가 변경되더라도 인식한 개체의 좌표값으로 알맞게 찍으려면 어떻게 해야하나요?
- 미해결딥러닝 웹서비스 프로젝트 1 - 기본편. Object Detect 불량품 판별
궁금한사항 올립니다.
항상 좋은 강의 감사합니다. 강의를 듣다보니 궁금한 사항이 생겨 질문 드립니다. 1. 딥러닝 모델 yolo이외의 모델로 학습한 모델일 경우(ex:NetinaNet, Maks R-CNN) 우선 yolo와 NetinaNet경우는 annotation파일을 xml로 만들어지고, Mask R CNN경우는 annotation파일이 json파일로 만들어 지는데(github경우) 이 경우 main.py에서 어떤 부분을 변경해야 다양한 딥러닝 모델을 활용해서 모바일 앱으로 사용 할 수 있습니까? 2. base64방식으로 변경하는 부분이 이해가 잘 되지 않아서 그럽니다. 혹시 참조할 만한 자료나 영상 추천해 줄 수 있습니까? 감사 합니다.
- 미해결딥러닝 웹서비스 프로젝트 1 - 기본편. Object Detect 불량품 판별
400 Bad Request 발생합니다.
안녕하세요. 강의 감사드립니다. 로컬로 접속해서 json return을 확인하려는데요. 아래와 같이 뜹니다. 코드는 다운 받은 그대로 사용했습니다. 잘 안되네요 ㅠ werkzeug.exceptions.BadRequestKeyError BadRequestKeyError: 400 Bad Request: The browser (or proxy) sent a request that this server could not understand. KeyError: 'model'
- 미해결딥러닝 웹서비스 프로젝트 1 - 기본편. Object Detect 불량품 판별
flask Method Not Allowed The method is not allowed for the requested URL오류발생
항상 좋은 강의 감사합니다. 열씸히 따라 하다 웹앱 웹서비스 테스트 마지막 부분에서 flask main.py실행 하였으나 제목 처럼 오류가 발생했습니다. main.py에서 methods는 ['POST']이고 host:127.0.0.1입니다. 여기저기 구글링 검색해도 명확한 답이 나오지 않아 이렇게 질문 드립니다. main.py 코드는 다음과 같습니다. 감사합니다 from flask import Flask, request, Response, jsonify import base64 from flask_cors import CORS import numpy as np import cv2 from PIL import Image from io import BytesIO confthres=0.5 #confidence값 0.5이상 값만 찾음 nmsthres=0.1 app = Flask(__name__) CORS(app) @app.route('/mobileweb/yolo', methods=['POST']) #web주소 세팅 def main(): labelsPath="./model/coco.names" configpath="./model/yolov3.cfg" weightspath="./model/yolov3.weights" print("[INFO] loading YOLO models...") LABELS = open(labelsPath).read().strip().split("\n") net = cv2.dnn.readNetFromDarknet(configpath, weightspath) #yolo file loading #image file -> ascii converter file = request.form['image'] starter = file.find(',') image_data = file[starter+1:] image_data = bytes(image_data, encoding="ascii") img = Image.open(BytesIO(base64.b64decode(image_data))) #img = cv2.imread('./railworker.jpg') npimg=np.array(img) image=npimg.copy() image=cv2.cvtColor(image,cv2.COLOR_BGR2RGB) (H, W) = image.shape[:2] ln = net.getLayerNames() ln = [ln[i[0] - 1] for i in net.getUnconnectedOutLayers()] #yolo model적용시 사용 blob = cv2.dnn.blobFromImage(image, 1 / 255.0, (416, 416), swapRB=True, crop=False) net.setInput(blob) layerOutputs = net.forward(ln) boxes = [] confidences = [] classes = [] results = [] for output in layerOutputs: for detection in output: scores = detection[5:] classID = np.argmax(scores) confidence = scores[classID] if confidence > confthres: #50%이상값만 찾음 box = detection[0:4] * np.array([W, H, W, H]) (centerX, centerY, width, height) = box.astype("int") x = int(centerX - (width / 2)) y = int(centerY - (height / 2)) boxes.append([x, y, int(width), int(height)]) confidences.append(float(confidence)) classes.append({'id': int(classID), 'name': LABELS[classID]}) idxs = cv2.dnn.NMSBoxes(boxes, confidences, confthres, nmsthres) if len(idxs) > 0: for i in idxs.flatten(): results.append({'class': classes[i], 'confidence': confidences[i], 'bbox': boxes[i]}) return jsonify(results) if __name__ == '__main__': app.run(debug=True, host='127.0.0.1')
- 미해결딥러닝 웹서비스 프로젝트 1 - 기본편. Object Detect 불량품 판별
app.yaml파일에 관해서
항상 좋은 강의로 감사 합니다. app.yaml파일에 관해 궁금해서 질문 드립니다. 강의 내용중에 app.yaml파일 작성할때 runtime:python37이라고 작성 했는데 여기서 python37의미가 python3.7 version을 사용 하겠다는 의미 인지요? 그게 맞다면 저 같은 경우는 python3.6.10버젼인데 python을 upgrade해서 3.7버젼으로 해야 하는지 궁금해서 질문 남깁니다.
- 미해결딥러닝 웹서비스 프로젝트 1 - 기본편. Object Detect 불량품 판별
python main.py실행하면 아무런 반응이 없습니다.
항상 좋은 강의 감사합니다. 플라스크 웹서비스 JSON으로 결과값 회신 강의 내용 중에서 python main.py하면 0.0.0.0:5000호스트에 실행이 되는 결과 값이 도출 되는데 어디가 잘 못 되었는지 python main.py를 실행해도 아무런 변화가 없습니다. error라도 나오면 머가 잘못 되었는지를 알겠는데..이렇게 실행이 안되니..머가 잘못 되었는지 모르겠습니다.