내 업무를 대신 할 파이썬(Python) 웹크롤링 & 자동화 (feat. 주식, 부동산 데이터 / 인스타그램)
requirements.txt 파일에 접근해서 pip install -r requirements.txt 해야하지 않습니까? 근데 이 파일에 접근이 안되는데 혹시 이유좀 알려주실 수 있나용 이것 구글에 쳐봐도 잘 모르겠어요 ㅜ 다운 받은 강의 자료를 지워서 새로 깔아도 안되고 파일 위치를 옮겨봐도 소용없어요. 그리고 dir로 디렉토리 띄워놓고 cd requirements.txt 칠때 탭으로 자동완성도 안되는거 보니 뭔가 연관이 있는거 같은데 알려주시면 감사하겠습니다
안녕하세요 강사님 mmdetection 관련해서 이론적으로나 실무적으로나 항상 많은 도움 받고있습니다. 강의 내용을 바탕으로 mmdetection code를 작성하던 도중 질문사항이 생겨서요 ㅎㅎ mmdetection Mask R-CNN 모델을 이용하여 추론결과 아래 사진과 같이 mask, bbox 두가지가 나타나는데 bbox위에 나타나는 title(coin) 대신 변수를 표시하고 싶습니다. class name, confidence score 가 아닌 ID, pixel number를 표시하고 싶습니다. 제 코드는 다음과 같습니다. img_name = path_dir + '/' + file_list[i] img_arr= cv2.imread(img_name, cv2.IMREAD_COLOR) img_arr_rgb = cv2.cvtColor(img_arr, cv2.COLOR_BGR2RGB) # cv2.imshow('img',img) fig= plt.figure(figsize=(12, 12)) plt.imshow(img_arr_rgb) # inference_detector의 인자로 string(file경로), ndarray가 단일 또는 list형태로 입력 될 수 있음. results = inference_detector(model, img_arr) #추론결과 디렉토리에 저장 model.show_result(img_arr, results, score_thr=0.8, title= bbox_color=(0,0,255),thickness=0.5,font_size=7, out_file= f'{save_dir1}{file_list[i]}') 이 결과 추론되는 사진은 다음과 같습니다 아래는 mmdetection/mmdet/core/visualization/image.py에 있는 imshow_det_bboxes 함수입니다. 아래 함수가 시각화 해주는 함수여서 해당 함수를 수정하면 될 것 같은데 아무리 뜯어봐도 어디를 고쳐야할 지 도저히 감이 오질 않습니다 ...ㅠㅠ def imshow_det_bboxes(img, bboxes, labels, segms=None, class_names=None, score_thr=0, bbox_color='green', text_color='green', mask_color=None, thickness=2, font_size=13, win_name='', show=True, wait_time=0, out_file=None): """Draw bboxes and class labels (with scores) on an image. Args: img (str or ndarray): The image to be displayed. bboxes (ndarray): Bounding boxes (with scores), shaped (n, 4) or (n, 5). labels (ndarray): Labels of bboxes. segms (ndarray or None): Masks, shaped (n,h,w) or None class_names (list[str]): Names of each classes. score_thr (float): Minimum score of bboxes to be shown. Default: 0 bbox_color (str or tuple(int) or :obj:`Color`):Color of bbox lines. The tuple of color should be in BGR order. Default: 'green' text_color (str or tuple(int) or :obj:`Color`):Color of texts. The tuple of color should be in BGR order. Default: 'green' mask_color (str or tuple(int) or :obj:`Color`, optional): Color of masks. The tuple of color should be in BGR order. Default: None thickness (int): Thickness of lines. Default: 2 font_size (int): Font size of texts. Default: 13 show (bool): Whether to show the image. Default: True win_name (str): The window name. Default: '' wait_time (float): Value of waitKey param. Default: 0. out_file (str, optional): The filename to write the image. Default: None Returns: ndarray: The image with bboxes drawn on it. """ assert bboxes.ndim == 2, \ f' bboxes ndim should be 2, but its ndim is {bboxes.ndim}.' assert labels.ndim == 1, \ f' labels ndim should be 1, but its ndim is {labels.ndim}.' assert bboxes.shape[0] == labels.shape[0], \ 'bboxes.shape[0] and labels.shape[0] should have the same length.' assert bboxes.shape[1] == 4 or bboxes.shape[1] == 5, \ f' bboxes.shape[1] should be 4 or 5, but its {bboxes.shape[1]}.' img = mmcv.imread(img).astype(np.uint8) if score_thr > 0: assert bboxes.shape[1] == 5 scores = bboxes[:, -1] inds = scores > score_thr bboxes = bboxes[inds, :] labels = labels[inds] if segms is not None: segms = segms[inds, ...] mask_colors = [] if labels.shape[0] > 0: if mask_color is None: # Get random state before set seed, and restore random state later. # Prevent loss of randomness. # See: https://github.com/open-mmlab/mmdetection/issues/5844 state = np.random.get_state() # random color np.random.seed(42) mask_colors = [ np.random.randint(0, 256, (1, 3), dtype=np.uint8) for _ in range(max(labels) + 1) ] np.random.set_state(state) else: # specify color mask_colors = [ np.array(mmcv.color_val(mask_color)[::-1], dtype=np.uint8) ] * ( max(labels) + 1) bbox_color = color_val_matplotlib(bbox_color) text_color = color_val_matplotlib(text_color) img = mmcv.bgr2rgb(img) width, height = img.shape[1], img.shape[0] img = np.ascontiguousarray(img) fig = plt.figure(win_name, frameon=False) plt.title(win_name) canvas = fig.canvas dpi = fig.get_dpi() # add a small EPS to avoid precision lost due to matplotlib's truncation # (https://github.com/matplotlib/matplotlib/issues/15363) fig.set_size_inches((width + EPS) / dpi, (height + EPS) / dpi) # remove white edges by set subplot margin plt.subplots_adjust(left=0, right=1, bottom=0, top=1) ax = plt.gca() ax.axis('off') polygons = [] color = [] for i, (bbox, label) in enumerate(zip(bboxes, labels)): bbox_int = bbox.astype(np.int32) poly = [[bbox_int[0], bbox_int[1]], [bbox_int[0], bbox_int[3]], [bbox_int[2], bbox_int[3]], [bbox_int[2], bbox_int[1]]] np_poly = np.array(poly).reshape((4, 2)) polygons.append(Polygon(np_poly)) color.append(bbox_color) label_text = class_names[ label] if class_names is not None else f'class {label}' if len(bbox) > 4: label_text += f'|{bbox[-1]:.02f}' ax.text( bbox_int[0], bbox_int[1], f'{label_text}', bbox={ 'facecolor': 'black', 'alpha': 0.8, 'pad': 0.7, 'edgecolor': 'none' }, color=text_color, fontsize=font_size, verticalalignment='top', horizontalalignment='left') if segms is not None: color_mask = mask_colors[labels[i]] mask = segms[i].astype(bool) img[mask] = img[mask] * 0.5 + color_mask * 0.5 plt.imshow(img) p = PatchCollection( polygons, facecolor='none', edgecolors=color, linewidths=thickness) ax.add_collection(p) stream, _ = canvas.print_to_buffer() buffer = np.frombuffer(stream, dtype='uint8') img_rgba = buffer.reshape(height, width, 4) rgb, alpha = np.split(img_rgba, [3], axis=2) img = rgb.astype('uint8') img = mmcv.rgb2bgr(img) if show: # We do not use cv2 for display because in some cases, opencv will # conflict with Qt, it will output a warning: Current thread # is not the object's thread. You can refer to # https://github.com/opencv/opencv-python/issues/46 for details if wait_time == 0: plt.show() else: plt.show(block=False) plt.pause(wait_time) if out_file is not None: mmcv.imwrite(img, out_file) plt.close() return img 감사합니다
AssertionError at /post/ The `.create()` method does not support writable nested fields by default. Write an explicit `.create()` method for serializer `instagram.serializers.PostSerializer`, or set `read_only=True` on nested serializer fields. 저 오류로 프로젝트 2번 갈아 엎었는데 똑같은 곳에서 계속 막히네요.
안녕하십니까 교수님 최근 진행중인 프로젝트 수행을 위해서 강의를 듣고 있는 학생입니다. 현재 depth camera 를 이용하는 딥러닝 프로젝트를 진행하며 여러가지 오픈소스를 찾던 중 ssd-mobilenet 을 PASCAL VOC 로 학습한 것과 같은 알고리즘 ssd-mobilenet를 사용하여 COCO dataset으로 학습된 것을 봤습니다. 만약 오픈 소스를 사용하는 입장이면(학습하는 시간을 고려하지 않았을 때) 무조건 데이터 분류가 많고, 사진 당 오브젝트 수가 많은 COCO 데이터셋이 학습된 소스가 좋다고 생각하는데 혹시 다른 차이가 있을까 궁금해서 이렇게 질문드리게 되었습니다 학습 분류가 많을수록 FPS 에 의한 차이가 있나요? 학습 분류가 많을수록 특정 사물에 대한 detection 성능의 차이가 있을 수 있나요? - 예를 들어 person 데이터만 필요할 때 PASCAL VOC, COCO 또는 open image 를 사용할 때 성능 차이가 발생하나요? 다른 차이가 있을까요? 강의는 항상 잘 듣고 있습니다. 덕분에 다양한 프로젝트를 진행하여 취업까지 연결할 수 있었습니다. 아직 반정도 남았지만 분발하여 꼭 완강하도록 하겠습니다. 감사합니다!!
안녕하세요. 다름이 아니라 AI HUB에 올라와 있는 k-pop 덴스 데이터 셋을 활용해 key point detection을 해보고 싶어서 질문드립니다. https://aihub.or.kr/aidata/34116 해당 데이터 셋을 보면 뭐 이름은 영상 데이터 셋으로 올라왔는데 파일은 jpg 파일이랑 json 파일로 구성되어 있구요. 이게 파일을 또 살펴보면 jpg파일이 정면 좌우 대각선 방향에서 찍혀있는 사진으로 구성되어 있는데 데이터를 입력할 때 유의해야할 점이있을 까요? 정면에서 하는 것 밖에 못한다든가 또 이렇게 jpg 파일로 학습 시킨 모델로 영상도 나중에 예측?할 때 활용할 수 있나요?
- 학습에 관련된 질문을 남겨주세요. 상세히 작성하면 더 좋아요! - 먼저 유사한 질문이 있었는지 검색해보세요. - 서로 예의를 지키며 존중하는 문화를 만들어가요. - 잠깐! 인프런 서비스 운영 관련 문의는 1:1 문의하기를 이용해주세요. post_list.html에서는 변수를 소문자로 변환한 모델명 + _list 로 사용했는데 post_detail.html에서는 변수를 소문자로 변환한 모델명(post)로 사용한건가요? 어떤 방식으로 하는건지 설명이 없어서요...
[리뉴얼] 처음하는 파이썬 백엔드와 웹기술 입문 (파이썬 중급, flask[플라스크] 로 이해하는 백엔드 및 웹기술 기본) [풀스택 Part1-1]
Figure.set_name("figure") print(Figure.name, Circle.name ) 여기서 빨간부분이 궁금한데요 저는 여기서 Circle클래스 객체가 생성이 안되어있다고 생각되어 이해가 안되는 부분입니다. Figure클래스의 객체만 생성된상태에서 어떻게 Circle.name 으로 접근이 가능한가요? 아래의 Circle.set_name("Circle")로 객체생성되어야 Circle.name 을 사용할수있지않나요?
django와 html을 연결하여 vscode내에서 로컬로 웹사이트를 볼 수 있게 설정한 뒤 aws를 이용하여 외부로 웹페이지를 배포하고자 유튜브에 올라와있는 (2257) Django 프로젝트 AWS 배포하기 - YouTube 를 참고하여 천천히 따라나갔습니다. vscode상에 있는 django와 html을 연결한 내용을 git에 올린 뒤 우분투에서 git clone을 통해 받아와 /home/ubuntu/내 프로젝트 를 완성하였고 유튜브를 따라 천천히 나아가다가 마지막에 service nginx start를 한 후 public 주소를 입력 시 502 에러가 뜨는 것을 확인하였습니다. 우분투 내에서 python manage.py runserver 0.0.0.0:8000을 입력하면 외부에서 홈페이지가 잘 뜨니 코드상에는 문제가 없는것 같고 우분투에서 /var/log/nginx/error.log을 통해 에러코드를 cat으로 확인하니 2022/06/14 14:17:05 [crit] 4751#4751: *1 connect() to unix:/home/ubuntu/Final-term-project-DjangoWeb-/uwsgi.sock failed (13: Permission denied) while connecting to upstream, client: 121.136.144.86, server: _, request: "GET / HTTP/1.1", upstream: "uwsgi://unix:/home/ubuntu/Final-term-project-DjangoWeb-/uwsgi.sock:", host: "52.35.25.97" 이렇게 떠서 구글링을 통해 권한을 shmod로777로 변환해보거나 해도 여전히 502가 떴었습니다. 이에 제가 내린 결론은 /etc/nginx/nginx.conf /etc/nginx/sites-enabled/default uwsgi.ini 이 세가지를 설정하는 과정에서 값을 틀리게 입력했다는 것이 저의 생각입니다. 이것이 현재 저의 home/ubuntu/프로젝트/ 의 상태입니다. html과 django의 연결은 구글링을 통해 한 웹사이트로 구성하였으며 이는 git 에 올라갔고 git clone을 통해 우분투에 받아와진 상태입니다. uwsgi.ini의 상태입니다. vi /etc/nginx/nginx.conf를 통해 입력한 값입니다. vi /etc/nginx/sites-enabled/default를 통해 입력한 값입니다. 이후 sudo service nginx restart를 시도한 후 aws에 있는 제가 만든 인스턴스의 public주소를 주소창에 입력하자 502 에러가 나왔고 에러log는 맨위에 있는 것이 나왔습니다. 여러 오타도 찾아보고 사용자권한도 설정하며 계속 수정해나갔지만 결과에 도달할 기미가 보이지 않아 질문/ 답변에 찾아와 질문드리게 되었습니다. 도움을 주시면 감사할 것 같습니다.
안녕하세요 종은 강의 잘 청강하고 있습니다. Mmdetection mask RCNN 모델을 훈련시키려고 하는데, 강좌중 정확도와 재현성에 대한 강의를 보고 궁금증이 생겼습니다. 정확도와 재현성을 조정이라는 표현이 맞는지 모르겟는데, 정확도와 재현성중 사용자가 둘중 어떤 것을 높여서 교육시키는 것이 가능한지요? 가능하다면 훈련시 어떤 변수를 조정해서 훈련을 시켜야하는지요?? Mmdetection. Config 변수가 너무 많아서 좀 복잡한것 같은데... 이러한 부분은 어떤 문서를 봐야 이해가 될수 있을까요?? 홈페이지도 너무 광범위해서 초보자는 좀 헤매게 되는것 같습니다. 참. 그리고 혹시 tracking 에 대한 강좌 계획은 없으신지도 궁금합니다.
안녕하세요. '딥러닝-컴퓨터비전-완벽가이드'를 수강하고 있는 고준규입니다. 다름이 아니라 정밀도와 재현율에 대해 질문이 있어서 글을 남깁니다. COCO 데이터셋이나 Pascal VOC 데이터셋과 같이 성능평가로 검증된 데이터셋이 아닌 직접 object detection을 사용하여 문제를 해결하기위해 custom 데이터를 활용하여 데이터 라벨링을 하였습니다. 이 때, 모델의 평가를 진행하였는데, precision score (0.6)가 recall score (0.9)에 비해 낮은 결과를 얻는 것을 확인했습니다. 이를 자체적으로 분석해본 결과, 사람이 직접 라벨링을 하다보니 사람이 놓친 부분을 모델이 탐지하여 precision score가 낮아지는 것을 확인하였고 결론지었습니다. 이럴 경우, custom 데이터셋을 새롭게 수정해서 학습을 시켜야하는 것이 맞는 방법인 것으로 보이나 현실적으로 이를 수정하기에는 비용이 생각보다 많이 들 것 같아서 다른 방법을 생각해보고 있습니다. 혹시 이와 관련되어 조언을 얻을 수 있을까요?
print('%1.18f ' %(3.14159265358979)) print('%6.2f' %(3.14159265358979)) f 앞에 있는 숫자의 정수부분이 출력되는 값의 총 자리수라고 영상 11:25 에 말씀하셨는데 그렇게 되면 %1.18f 는 출력되는 값의 총 자리수가 1자리여야 되는 거 아닌가요..? 근데 왜 3.14159265358979 값이 전부 출력되는 건가요..?
[리뉴얼] 처음하는 파이썬 데이터 분석 (쉽게! 전처리, pandas, 시각화 전과정 익히기) [데이터분석/과학 Part1]
- 기존 사이트였던 www.countryflags.io 가 flagcdn.com 로 대체되면서 직접 따라해보니, 2가지 문제점이 있는 걸 발견했습니다. 1. 대문자로는 404 Not Found가 뜹니다. - 따라서 이미지 링크를 만들 때는 .lower() 로 소문자 변경 처리를 해줘야 합니다. - ex) https://flagcdn.com/48x36/US.png -> https://flagcdn.com/48x36/us.png 2. 국기 매칭 오류 - iso2와 Country_Region 를 매칭할 때부터 오류가 있는 것을 확인했습니다. - 시각화를 하면서 US가 워낙 인구가 많기에 눈에 보였지만 다른 것들도 제대로 매칭되었는 지는 확신할 수 없습니다. - 강의 자료를 바탕으로하면, US의 경우 AS로 매칭이 되어서 https://flagcdn.com/48x36/as.png 국기가 뜨더라구요. - 물론 강사님 말씀처럼, 이미지는 참고용이므로 크게 신경쓰지 않아도 될 문제같습니다. 그래서 저는 만들어진 데이터 프레임 값 중 US만 변경하려고 다음과 같이 허접하게 함수를 만들어서 보정했습니다. ㅎㅎ;; def test_func(row): if(row['Country_Region'] == 'US'): row['Country_Flag'] = 'https://flagcdn.com/48x36/us.png' return row doc_final_country = doc_final_country.apply(test_func, axis=1) 대강 국기가 잘 나오는 것 같네요. 혹시나 이 수업을 들으시는 누군가에게 도움이 될까..? 하여 간단히 기록 남겨봅니다..!