내 업무를 대신 할 파이썬(Python) 웹크롤링 & 자동화 (feat. 주식, 부동산 데이터 / 인스타그램)
requirements.txt 파일에 접근해서 pip install -r requirements.txt 해야하지 않습니까? 근데 이 파일에 접근이 안되는데 혹시 이유좀 알려주실 수 있나용 이것 구글에 쳐봐도 잘 모르겠어요 ㅜ 다운 받은 강의 자료를 지워서 새로 깔아도 안되고 파일 위치를 옮겨봐도 소용없어요. 그리고 dir로 디렉토리 띄워놓고 cd requirements.txt 칠때 탭으로 자동완성도 안되는거 보니 뭔가 연관이 있는거 같은데 알려주시면 감사하겠습니다
안녕하세요. 루키스님! 질문이 있는데요. "데이터베이스 원리" 챕터 강의는 CAP 이론을 물류 창고로 비유하여 설명하신 것 같습니다. 만약 그렇다면 3가지 항목이 다음과 같이 연결되는 것이 맞는지 궁금합니다. 1) 많이 - 네트워크 파티션 허용(Partition tolerance) - 2개의 물류 창고로 운영하면 많은 물건을 처리할 수 있지만 하나의 물류창고가 피해를 입어도 다른 하나를 사용할 수 있다고 생각합니다. 2) 빠르게 - 가용성(Availability) - 창고에서 언제나 물건을 꺼낼 수 있는 상황이라면 빠르 처리가 가능할 것으로 생각합니다. 3) 안전하게 - 일관성(Consistency) - 창고에서 꺼낸 물건이 정확하다는 것이 안전한 것이라고 생각합니다.
SELECT DATE_TRUNC('week', e1.occurred_at) AS week , COUNT(CASE WHEN e1.action = 'sent_weekly_digest' THEN e1.user_id ELSE NULL END) AS weekly_digest_email , COUNT(CASE WHEN e1.action = 'sent_weekly_digest' THEN e2.user_id ELSE NULL END) AS weekly_digest_email_open , COUNT(CASE WHEN e1.action = 'sent_weekly_digest' THEN e3.user_id ELSE NULL END) AS weekly_digest_email_clickthrough FROM tutorial.yammer_emails e1 LEFT JOIN tutorial.yammer_emails e2 ON e2.occurred_at BETWEEN e1.occurred_at AND e1.occurred_at + INTERVAL '5 MINUTE' AND e2.user_id = e1.user_id AND e2.action = 'email_open' LEFT JOIN tutorial.yammer_emails e3 ON e3.occurred_at BETWEEN e1.occurred_at AND e1.occurred_at + INTERVAL '5 MINUTE' AND e3.user_id = e1.user_id AND e3.action = 'email_clickthrough' WHERE occurred_at BETWEEN '2014-06-01 00:00:00' AND '2014-08-31 23:59:59' AND action IN ('sent_weekly_digest', 'sent_reengagement_email') GROUP BY week; 야머스 차트로부터의 쿼리말고 강의때 작성해주신 쿼리로 피봇테이블까지 작성해보고 싶은데 자꾸 오류가 나서요 쿼리문 혹시 따로 올려주실 수 있으실까요?
안녕하세요 강사님 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번 갈아 엎었는데 똑같은 곳에서 계속 막히네요.
안녕하세요 오늘도 좋은 강의 감사합니다. 다름이 아니라 첫번째 with temp_01 as 쿼리를 시작하시는 부분에 질문이 있어요. 처음에 group by를 하실 때, product_id만 하시고 categroy_id는 크게 할 필요가 없으시다는 말씀을 하셨던 부분 이해를 완료했습니다. 그런데 선생님의 강의를 듣기 전에, 제가 문제를 먼저 풀었을 때 저는 group by에 category_id도 같이 추가를 하여 문제를 풀었습니다. 확인해보니 답은 동일하게 나왔더라고요. 그럼 제가 했던 방식으로 하여도 전혀 문제가 없는 것일까요? 혹시 몰라 제가 짰던 쿼리를 밑에 남겨놓겠습니다! (일부 알리아스 이름은 선생님께서 하신 부분과 비슷하게 맞춰놓았습니다) with temp_01 as ( select p.category_id , p.product_id , sum (oi.amount) sum_by_product -- 상품별 총합 from nw.order_items oi join nw.products p on oi.product_id = p.product_id group by p.category_id , p.product_id ), temp_02 as ( select category_id , product_id , sum_by_product , sum (sum_by_product) over ( partition by category_id) sum_by_category -- category별 총합 , row_number () over ( partition by category_id order by sum_by_product desc ) ranking_category -- 카테고리별 상품 순위 from temp_01 ) select * from temp_02 where sum_by_product >= 0.05*sum_by_category and ranking_category <= 3 order by category_id;
안녕하십니까 교수님 최근 진행중인 프로젝트 수행을 위해서 강의를 듣고 있는 학생입니다. 현재 depth camera 를 이용하는 딥러닝 프로젝트를 진행하며 여러가지 오픈소스를 찾던 중 ssd-mobilenet 을 PASCAL VOC 로 학습한 것과 같은 알고리즘 ssd-mobilenet를 사용하여 COCO dataset으로 학습된 것을 봤습니다. 만약 오픈 소스를 사용하는 입장이면(학습하는 시간을 고려하지 않았을 때) 무조건 데이터 분류가 많고, 사진 당 오브젝트 수가 많은 COCO 데이터셋이 학습된 소스가 좋다고 생각하는데 혹시 다른 차이가 있을까 궁금해서 이렇게 질문드리게 되었습니다 학습 분류가 많을수록 FPS 에 의한 차이가 있나요? 학습 분류가 많을수록 특정 사물에 대한 detection 성능의 차이가 있을 수 있나요? - 예를 들어 person 데이터만 필요할 때 PASCAL VOC, COCO 또는 open image 를 사용할 때 성능 차이가 발생하나요? 다른 차이가 있을까요? 강의는 항상 잘 듣고 있습니다. 덕분에 다양한 프로젝트를 진행하여 취업까지 연결할 수 있었습니다. 아직 반정도 남았지만 분발하여 꼭 완강하도록 하겠습니다. 감사합니다!!
훌륭한 강의를 듣고 있는 와중에 궁금점이 생겼습니다. group by 를 수행한 후에 주문 건수를 집계할 때 count(*) 함수 혹은 count(distinct order_id)를 사용하시던데, 주문 번호가 중복되어있을 경우에는 distinct 함수를 통해 중복을 제거후 count() 집계를 사용해야 된다고 알고 있습니다. 그런데 order별 특정 상품 주문시 함께 가장 많이 주문된 다른 상품 추출하기 쿼리에서, select prod_01, prod_02, count(*) from temp_01 group by prod_01, prod_02 부분을 보면 count(*)를 사용한 것이 이해가 잘 가지 않습니다 ㅠㅠ 그 앞의 temp_01 절에서 ga.order_items 테이블을 사용하는 데 해당 테이블에는 order_id가 중복되어 있는 것으로 알고 있습니다. 그러면 후에 건수 집계시 count(distinct temp_01.order_id)로 해야 하는 것이 아닌가 궁금합니다. 아니면 count(*)의 의미가 애초에 주문 건수를 의미하는 것이 아닌지 궁금합니다. 늘 수고 많으십니다.
안녕하세요. 다름이 아니라 AI HUB에 올라와 있는 k-pop 덴스 데이터 셋을 활용해 key point detection을 해보고 싶어서 질문드립니다. https://aihub.or.kr/aidata/34116 해당 데이터 셋을 보면 뭐 이름은 영상 데이터 셋으로 올라왔는데 파일은 jpg 파일이랑 json 파일로 구성되어 있구요. 이게 파일을 또 살펴보면 jpg파일이 정면 좌우 대각선 방향에서 찍혀있는 사진으로 구성되어 있는데 데이터를 입력할 때 유의해야할 점이있을 까요? 정면에서 하는 것 밖에 못한다든가 또 이렇게 jpg 파일로 학습 시킨 모델로 영상도 나중에 예측?할 때 활용할 수 있나요?
현업에서 일을 하면서 가끔 부딪히는 문제인데 쿼리 요청 횟수를 줄이기 위해서 해당 레코드에 필요없는 데이터를 부득이하게 가져와야 하는 경우가 있는데 불필요한 열 참조를 하지 않기 위해서 쿼리 횟수를 늘리는 것이 좋은지 불필요한 열까지 가져오되 쿼리 횟수를 한번으로 하는 것이 좋은지 여쭙고 싶습니다.
안녕하세요 select order_date from NorthWind.orders where order_id in ( select order_id from customers) ; 부분에서 쿼리에러는 발생하지 않지만 , 최종결과에서는 우리가 생각하는것과 달리 전체 데이터를 출력하고있잖아요 . 그 이유가 무엇이라고용 ?? 서브쿼리에서 외부 테이블의 칼럼을 참조하고있으면 그런건가용?? 왜그런걸까용 ? ㅎㅎ customers 테이블엔 order_id 칼럼이 존재하지 않고 , 외부에있는 order_id 를 참조하고있으니 그냥 값만 들어있어도 전체쿼리가 출력이 되는걸까요 ??
저는 주로 group by 할때 아래처럼 select 에 들어가는 칼럼을 몽땅 넣는데 select b.dname, a.empno, a.ename, round(avg(c.sal), 2) group by b.dname, a.empno, a.ename 선생님처럼 max 같은 집계함수로 처리하는거랑 어떤 차이가 있나요??