묻고 답해요
158만명의 커뮤니티!! 함께 토론해봐요.
인프런 TOP Writers
-
해결됨(UPDATED) Python을 이용한 개인화 추천시스템 | 추천알고리즘 | 추천인공지능
사용자 집단별 추천 코드
코드 내에서 score(model)안에 model로 best_seller, cf_gender등을 사용하셨는데, best_seller와 cf_gender함수는 user_id와 movie_id를 변수로 가지는데, score함수 안에 사용할 때는 score(best_seller)로 써도 작동되는 이유가 무엇인가요? score(best_seller(user_id, movie_id))와 같이 써야 작동되는것 아닌가요?
-
해결됨(UPDATED) Python을 이용한 개인화 추천시스템 | 추천알고리즘 | 추천인공지능
무비렌즈 최신 데이터를 이용하고싶은데요~
안녕하세요 거친코딩님!해당 알고리즘을 최신 무비렌즈 데이터를 이용해서 구현하려하는데요.해당 압축파일에 있는 파일과 강사님이 올려주신 파일이 확장자명이 다른데,최신파일로 구현하고자하면 밑에 파일에서 어떤걸 건들어야할까요?
-
해결됨(UPDATED) Python을 이용한 개인화 추천시스템 | 추천알고리즘 | 추천인공지능
추천시스템의 이진데이터 적용
안녕하세요. 데이터분석 공부하는 학생입니다.올려주신 강의 모두 잘 들었습니다.다만 제가 지금 적용하고자 하는 데이터가 이진데이터인데요.강의의 코드가 이진데이터에는 맞지 않아 문의드립니다.이진데이터를 추천시스템에 활용하는 다른 예도 찾아 보았는데요: https://towardsdatascience.com/recommender-systems-item-customer-collaborative-filtering-ff0c8f41ae8a어차피 여기서도 코사인유사도를 활용하고 있어거친코딩님의 강의의 예를 활용하고 싶은데 잘 안되네요.혹시 한 번 봐주실 수 있을까요?적용 코드: https://drive.google.com/file/d/11qlP4zOAFewSiHxo_T7fp_Ql-WgSpHS3/view?usp=sharing
-
해결됨[개정판] 딥러닝 컴퓨터 비전 완벽 가이드
데이터 전처리
데이터 전처리 시 왜 0~ 255 사이의 픽셀값을 0 ~ 1 사이 값으로 변환해주는 걸까요?자료의 범위가 맞춰져야 해서인 거 같은데 자세한 이유가 알고 싶습니다.
-
해결됨(UPDATED) Python을 이용한 개인화 추천시스템 | 추천알고리즘 | 추천인공지능
평가 관련
안녕하세요 강사님. 평가 지표에 관련된 내용을 여쭤보려고 합니다. mAP, nDCG 같은 성능을 측정하려면 어떻게 해야 하나요?
-
미해결[개정판] 딥러닝 컴퓨터 비전 완벽 가이드
mAP 0.5와 mAP 0.5-0.95의 차이
mAP의 측정 기준 중mAP0.5와 mAP 0.5-0.95는 무엇을 의미하나요?보니까 IoU를 0.5에서 0.95까지 0.05씩 올려가면서 측정한 평균 mAP라는데, 이것이 무엇을 의미하는 지 자세히 모르겠습니다
-
미해결[개정판] 딥러닝 컴퓨터 비전 완벽 가이드
faster-rcnn inference 오류
현황 : BCCD에서 사용하던 코드로 Inference를 하려 했는데다음과 같은 오류가 발생하고 있습니다바쁘시겠지만 문의드립니다◇ 문의사항: 해결방안이 있을까요?코드import torchfrom mmdet.apis import multi_gpu_test, single_gpu_testfrom mmcv.parallel import MMDataParallel, MMDistributedDataParallelmodel_ckpt = MMDataParallel(model_ckpt, device_ids=[0])outputs=single_gpu_test(model_ckpt, data_loader, True, "저장폴더", 0.5)--------------------------------------------------------------------------- AssertionError Traceback (most recent call last) Input In [6], in <cell line: 8>() 5 model_ckpt = MMDataParallel(model_ckpt, device_ids=[0]) 6 # single_gpu_test를 활용하므로 samples_per_gpu는 1이 되야함 ----> 8 outputs=single_gpu_test(model_ckpt, data_loader, True, "저장폴더", 0.5) File ~/.local/lib/python3.9/site-packages/mmdet/apis/test.py:38, in single_gpu_test(model, data_loader, show, out_dir, show_score_thr) 36 img_tensor = data['img'][0].data[0] 37 img_metas = data['img_metas'][0].data[0] ---> 38 imgs = tensor2imgs(img_tensor, **img_metas[0]['img_norm_cfg']) 39 assert len(imgs) == len(img_metas) 41 for i, (img, img_meta) in enumerate(zip(imgs, img_metas)): File ~/.local/lib/python3.9/site-packages/mmcv/image/misc.py:34, in tensor2imgs(tensor, mean, std, to_rgb) 32 if torch is None: 33 raise RuntimeError('pytorch is not installed') ---> 34 assert torch.is_tensor(tensor) and tensor.ndim == 4 35 channels = tensor.size(1) 36 assert channels in [1, 3] AssertionError: show_result_pypot 사용 시 오류가 발생하는데해결방안이 있을까요?코드from mmdet.apis import show_result_pyplotimport cv2#brg image 사용img = cv2.imread("sample 이미지 위치")model.cfg = cfgresult = inference_detector(model, img)show_result_pyplot(model, img, result, score_thr=0.3)결과/home/namu/.local/lib/python3.9/site-packages/mmdet/datasets/utils.py:66: UserWarning: "ImageToTensor" pipeline is replaced by "DefaultFormatBundle" for batch inference. It is recommended to manually replace it in the test data pipeline in your config file. warnings.warn(
-
해결됨(UPDATED) Python을 이용한 개인화 추천시스템 | 추천알고리즘 | 추천인공지능
딥러닝 추천시스템 변수추가 부분 코드 관련 질문입니다.
기존에 코드에 나와있는 occupation에 더해 age 변수를 추가하고 싶습니다. 하지만 age embedding layer에 들어갈 input dimension을 len(users['age'].unique()) 라 설정하고 모델을 fit 시키면 InvalidArgumentError: Graph execution error: 라는 에러가 뜹니다. 이때, age embedding layer의 input dimension을 len(users)라고 설정하면 fit 코드가 정상적으로 진행됩니다. 그 이유와 변수 embedding layer의 input dimesion을 설정할 때 꼭 unique 값의 개수를 넣어야 하는건지, 그리고 그 이유 도 알고 싶습니다.
-
해결됨(UPDATED) Python을 이용한 개인화 추천시스템 | 추천알고리즘 | 추천인공지능
딥러닝을 위한 추천시스템 원핫 인코딩 질문
148페이지 그림을 보면 유저아이디와 아이템 아이디를 원핫벡터 인코딩 한후에 임베딩 레이어에 들어가는데 왜 책에 있는 코드는 원한 인코딩을 적용 하지 않는지 궁금합니다. 원핫 인코딩을 적용하지 않은 이유를 알려주셨으면 합니다.
-
미해결
yolact에서 eval.py의 역할이 무엇인가요..?
yolact 설치 시 파일에 들어있는 eval.py의 용도가 무엇인가요..?
-
미해결딥러닝 CNN 완벽 가이드 - TFKeras 버전
미니배치 관련 질문
안녕하세요 선생님! BGD도 1:507 까지 모든 데이터를 순회하고 mini BGD도 사이즈를 나눠서 하지만 모든 데이터로 업데이트를 한다고 생각하는데 , 둘의 차이점이 무엇인가요?
-
미해결[개정판] 딥러닝 컴퓨터 비전 완벽 가이드
mmdetection (mask_rcnn) 인퍼런스 관련 질문입니다.
안녕하세요. 좋은강의 잘 듣고 있습니다. 얼마전에 mmd-to-tensorrt 질문을 올렸었는데요. 사실 해당 라이브러리를 사용해보려 한 목적이 Inference의 속도를 향상시키려는 시도의 일환이었습니다. 혹시 mmdetection을 이용한 mask_rcnn 의 추론 속도를 향상시키는 다른 방안을 알고계신가 싶어 질문 드립니다. mmdetection에 포함된 다른 instance segmentation 검출 로직인 yolact를 사용하면 미세하게 속도의 향상이 있으나 검출 정확성 측면에서 mask rcnn이 더 낫더라구요. 항상 좋은 강의 감사드립니다.
-
미해결[개정판] 딥러닝 컴퓨터 비전 완벽 가이드
MMDetection To TensorRT 를 사용시 Mask_RCNN Dimension 문제가 발생합니다 ㅠㅠ
안녕하세요. 선생님의 MMDetection 강의를 보고 여러가지 만들어보고 있는 학생입니다. 다름이 아니고 mask_rcnn에 tensorrt를 적용해보고자 하여 mmd to tensorrt 라는 github를 발견하고 사용해보았습니다. https://github.com/grimoire/mmdetection-to-tensorrt 일단 설치하고 모델 적용을 하는데 기본값으로 모델을 변환하고 추론하면 추론이 되긴 하는데 segm 가 빠진 bbox만 검출이 됩니다. 그리고 파라미터를 수정해서 seg trt_model = mmdet2trt( cfg_path, args.checkpoint, fp16_mode=args.fp16, device=args.device, enable_mask=True, opt_shape_param=opt_shape_param, output_names=["num_detections", "boxes", "scores", "classes", "masks"] ) 요런식으로 만들어 모델을 돌려보면 IndexError: Dimension out of range (expected to be in range of [-1, 0], but got 1)가 가 계속 뜨는데요. 혹시 도움주실수 있을까 하여 작성했습니다. 좋은 강의 감사히 보고있습니다. 감사합니다.
-
해결됨최신 딥러닝 기술 Vision Transformer 개념부터 Pytorch 구현까지
Transformer의 input에 대해 질문드립니다.
안녕하세요. Transformer에 대해 공부하면서 궁금한 점?이 있어 질문 글을 올리게 되었습니다. Transformer는 기존 seq2seq 구조와 다르게 input이 통째로 들어가서 병렬계산이 가능하다는 장점이 있다고 알고 있었습니다. 하지만 Transformer의 input도 문장의 위치에 따라 Positional Encoding(위치에 따른 sin, cos 값)이 더해지는 형태이기 때문에 일련의 sequence 형태를 가져야 된다 생각했습니다. 위는 제가 만든 그림예시인데, input 문장이 "I am student"라면, "I student am"처럼 순서를 바꿀 경우 positional encoding 값이 위치에 따라 특정 값이 들어가고 기존의 input 값과 다르기 때문에 결과적으로 Transformer의 input도 순서를 가져야만 된다라는 결론에 도달했습니다. 그렇게 된다면 순차적으로 값을 입력하는 기존 RNN 및 LSTM의 seq2seq와 input 측면에서 크게 나아진점이 없어보이는데 이 관점이 맞는걸까요? 제가 생각했던 것을 글로 표현하여 질문을 하다보니, 두서가 없는 점 죄송합니다.
-
해결됨(UPDATED) Python을 이용한 개인화 추천시스템 | 추천알고리즘 | 추천인공지능
MergeError가 납니다
강의 12분 26초에 성별에 따른 예측값 계산할 때, pd.merge(x_train, users) 부분에서 MergeError: No common columns to perform merge on. Merge options: left_on=None, right_on=None, left_index=False, right_index=False와 같은 에러메시지가 뜹니다. 어떻게 해결하면 될까요?
-
미해결딥러닝 CNN 완벽 가이드 - TFKeras 버전
1 x 1 convolution을 적용하면 왜 비선형성이 좋아지는지 궁금합니다.
선생님. 처음부터 쭉 듣다보니, 어느새 절반 이상을 듣게 되었습니다! 좋은 강의 감사드립니다. 1 x 1 convolution을 적용하면 왜 비선형성이 좋아지는지 궁금합니다. convolution은 시행할수록 비선형성이 항상 좋아지는것인가요??
-
해결됨머신러닝/딥러닝으로 이어지는 선형대수
nXn 행렬 A가 역행렬이 존재할 때 A와 I_n이 row equivalent한 이유가 무엇인가요??
안녕하세요 강사님 개인적으로 질문이 있어 문의드립니다. 6강 행렬식풀이 강의에서 nXn 행렬 A가 역행렬이 존재할 때 A와 I_n이 row equivalent하다. (서로 동치)다고 말씀주셨는데 그러한 이유가 무엇인가요?? 강의에서는 직관적으로 설명해주셨는데, det(A)!=0 인 이유와 연관되어서 그런가요??
-
미해결
딥러닝 학습 중, Training loss와 Test accuracy 간의 연관성
안녕하세요! CIFAR-100의 이미지 분류 task 수행 중, 궁금한 점이 생겨 질문드립니다! 위 결과를 보면 optimizer 1로 학습한 모델의 training loss 가 훨씬 큼에도 Test acc는 비슷한 수준이거나 더 높은 수치를 기록하고 있습니다. 이러한 원인을 알 수 있을까요?
-
미해결[개정판] 딥러닝 컴퓨터 비전 완벽 가이드
mmdetection mask-rcnn 추론결과 title 이름 변경 관련
안녕하세요 강사님 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 감사합니다
-
미해결딥러닝 CNN 완벽 가이드 - TFKeras 버전
선생님. 강의를 듣다보니, batch 크기와 관련하여 질문이 있습니다.
선생님. 강의를 듣다보니, batch 크기와 관련하여 질문이 있습니다. 강의 말미에 GPU는 batch크기가 클수록 학습이 빨라져서 속도가 빠르다고 하셨습니다. 그렇다면, H/W의 성능이 좋다는 가정하에, batch 크기를 증가시키면 같은 결과지만 속도가 빨라지는 차이만 있는것인가요? 아니면, 학습을 시키는 적정한 batch 사이즈가 있는것인가요?