목록전체글 (78)
코드민수



https://www.anaconda.com/ Anaconda | The World's Most Popular Data Science Platform Anaconda is the birthplace of Python data science. We are a movement of data scientists, data-driven enterprises, and open source communities. www.anaconda.com 1. 가상환경 생성 conda env create -n conda_env python==3.8 conda_env = 가상환경 명 3.8 = 파이썬 버전 2. 가상환경 삭제 conda env remove -n conda_env 3. 가상환경 복사 conda create -n c..
tensorflow에서 GPU 사용 가능 여부 확인 from tensorflow.python.client import device_lib device_lib.list_local_devices() Pytorch에서 GPU 사용 가능 여부 확인 import torch print(torch.cuda.is_available()) CUDA, cudnn, tensorflow, pytorch가 버전에 맞게 잘 설치되어 있어야 작동합니다.
오픈소스 딥러닝 데이터세트를 사용할 때 간혹 이미지는 있지만 레이블이 없는 경우가 있습니다. 해당 이미지들을 사용해서 새로 레이블을 구축하기 위해 레이블이 없는 이미지만 새로운 폴더에 복사하는 간단한 파이썬 코드를 구현했습니다. import os from tqdm import tqdm import shutil image_dir = '경로1' # 이미지 폴더 label_dir = '경로2' # 레이블 폴더 save_dir = '경로3' # 레이블이 없는 이미지를 복사할 경로 f_imgs = os.listdir(image_dir) for i in tqdm(f_imgs): image = os.path.join(image_dir, i) label = os.path.join(label_dir, i.replace(..
문제 출처 : https://www.kaggle.com/datasets/agileteam/bigdatacertificationkr Big Data Certification KR 빅데이터 분석기사 실기 (Python, R tutorial code) www.kaggle.com Q1) 첫번째 데이터부터 순서대로 50:50으로 데이터를 나누고, 앞에서부터 50%의 데이터(이하, A그룹)는 'f1'컬럼을 A그룹의 중앙값으로 채우고, 뒤에서부터 50% 데이터(이하, B그룹)는 'f1'컬럼을 B그룹의 최대값으로 채운 후, A그룹과 B그룹의 표준편차 합을 구하시오 단, 소수점 첫째자리까지 구하시오 (둘째자리에서 반올림) import pandas as pd df = pd.read_csv('data/basic1.csv')..

우선 저는 4회차였나 22년도에 빅데이터분석기사를 취득하였습니다. 시간이 많이 지나긴 했지만 당시 제가 공부하면서 정리했던 내용이 있어서 블로그에도 글로 남겨두려고 합니다. 이번 포스팅은 실기 작업형에서 간단하지만 자주 사용되는 코드입니다. 결측치 확인 print(df.isnull().sum()) 결측치 채우기 df = df.fillna(df['칼럼명'].mean()) # mean, median, min, max 등 # 뒤에 나오는 값으로 채우기 df = df.fillna(method='bfill') # 앞에 값으로 채우기 method=ffill 결측치 제거 df = df.dropna(subset=['칼럼명']) # axis=0 or 1 -> 결측치가 있는 row, col을 drop Pandas Data..

객체 탐지(Object Detection) 모델을 학습하기 위해 사용하는 JSON 포맷 라벨 데이터에서 각 클래스별 객체 수를 count해서 히스토그램으로 시각화 하는 코드입니다. import os import json import matplotlib.pyplot as plt path = '경로' # JSON 파일 있는 경로 classes = {'Glass': 1, 'Metal': 2, 'Wood': 3, 'Plastic': 4, 'Fish_trap': 5, 'Rubber_tire': 6, 'Rubber_etc': 7, 'Etc': 8} num = len(classes) histogram = [0] * num for file in os.listdir(path): with open(os.path.join(..