반응형

출처 : 

https://school.programmers.co.kr/learn/courses/30/lessons/181832

 

프로그래머스

코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.

programmers.co.kr

 

오른방향 -> 아래방향 -> 왼쪽 방향 -> 윗방향 -> 오른방향 .. 이런식으로 진행한다 

다음의 값이 0이 아닌 것을 체크하여 진행한다.

 

def solution(n):
    answer = [[0 for i in range(n)] for j in range(n)]
    num = 1
    i,j = 0,0
    dir = "right"
    while num < (n * n + 1):
        answer[i][j] = num
        # 오른쪽으로 진행 
        if dir == "right":
            if (j < n - 1) and (answer[i][j+1] == 0):
                j += 1
            else:
                dir = "down"
                i += 1
        elif dir == "down":
            if (i < n - 1) and (answer[i+1][j] == 0):
                i += 1
            else:
                dir = "left"
                j-= 1
        elif dir == "left":
            if (j > 0) and (answer[i][j-1] == 0):
                j -= 1
            else:
                dir = "up"
                i -= 1
        else:
            if (i > 0) and (answer[i-1][j] == 0):
                i -= 1
            else:
                dir = "right"
                j += 1
        num += 1
        #print(answer)
        
            
    return answer
반응형

'문제 > 프로그래머스' 카테고리의 다른 글

[1차] 프렌즈4블록  (1) 2022.10.01
피로도  (0) 2022.08.06
H-Index  (0) 2022.06.30
이중우선순위큐  (0) 2022.06.21
디스크 컨트롤러  (0) 2022.06.15
반응형

논문 

Mingxing Tan 1 Quoc V. Le 1

Abstract

model scaling을 체계적으로 연구하고 network depth, width, and resolution 을 조정하여 성능 향상

a new scaling method → uniformly scales all dimensions of depth/width/resolution using a simple yet highly effective compound coefficient.

EfficientNets

소스 코드 : https://github.com/tensorflow/tpu/tree/master/models/official/efficientnet

1. Introduction/2. Related Work

depth more layer ResNet, VGG
width channel의 개수 Wider Residual Networks, MobileNets
image resolution input image의 resolution을 키움 Gpipe

compound scaling method

효과적인 이유 : input image is bigger → the network needs more layer to increase the receptive field and more channels to capture more fine-grained patterns on the bigger image.

3. Compound Model Scaling

3.1. Problem Formulation

3.2. Scaling Dimensions

Depth (d): 자주 사용하는 방식

depth 를 깊이 할 경우 high level의 feature를 뽑을 수 있고 generalize 잘 되고 성능이 올라간다

하지만 어느 정도 까지 갈 경우 saturate 상태가 된다.

The intuition is that deeper ConvNet can capture richer and more complex features, and generalize well on new tasks.

하지만 , networks 가 깊어지면 깊어질수록 학습하기 어렵고 vanishing gradient problem이 있다.

skip connection, batch normalization 으로 학습 문제를 완화하지만 매우 깊은 network의 정확도 이득은 감소한다. 예를 들어 ResNet-1000은 ResNet-101 비슷한 정확도를 가진다.

width(w) : small size models에 자주 사용

fine-grained features 쉽게 뽑아내고 train을 쉬운 경향이 있다.

channel을 널리면 network depth를 줄이기 때문에 higher level features이 덜 얻게 되는 문제가 있을 수 있다.

Resolution (r): capture more fine-grained patterns

Resolution  
224x224 early ConvNets
299x299 Rethinking the inception architecture for computer vision
331X331 Learning transferable architectures for scalable image recognition. CVPR, 2018. NasNet
480x480 Gpipe: Efficient training of giant neural networks using pipeline parallelism.
600x600 Mask-RCNN, FPN

너무 크면 정확도도 떨어지고 계산량도 많아진다.

위의 그림을 보시면 width scaling, depth scaling 은 비교적 이른 시점에 정확도가 saturation 되며 그나마 resolution scaling이 키우면 키울수록 정확도가 잘 오르는 것을 확인할 수 있다.

Observation 1 – 네트워크의 width, depth, resolution 중 어느 차원을 scale up 시켜도 성능은 향상된다. 그러나 너무 큰 모델에 있어서는 그 성능 향상이 saturate된다.

3.3. Compound Scaling

직관적으로 생각해보면 Input image가 커지면 그에 따라서 receptive field도 늘려줘야 하고 더 많은 layer가 필요하고 , resolution 이 커져서 특징들을 뽑아낼려면 더 많은 channel이 필요한 것

resolution 키우면 그것에 맞게 depth와 width도 키워야 될 것이다.

Observation 2 –성능과 효율성을 높이기 위해서 ConvNet scaling을 진행할 때, width, depth, resolution의 모든 차원의 밸런스를 맞추는게 중요하다.

compound scaling method

4. EfficientNet Architecture

MnasNet과 비슷한데 latency가 들어있지 않는다.

5. Experiments

5.1. Scaling Up MobileNets and ResNet

기존에 존재한 모델 baseline, depth, width, resolution, compound scale를 변경하여 하였지만 그중에서 compound scale의 정확도가 높았다.

5.2. ImageNet Results for EfficientNet

MnasNet: Platform-aware neural architecture search for mobile. CVPR, 2019 RMSProp optimizer with decay 0.9 and momentum 0.9 batch norm momentum 0.99 weight decay $1e^{-5}$ initial learning rate 0.256 that decays by 0.97 every 2.4 epochs SiLU (Swish-1) activation AutoAugment stochastic depth (Huang et al., 2016) with survival probability 0.8 As commonly known that bigger models need more regularization, we linearly increase dropout (Srivastava et al., 2014) ratio from 0.2 for EfficientNet-B0 to 0.5 for B7.

Table 2

정확도는 비슷하지만 parameter 수와 FLOPS수 가 적다.

parameters-accuracy and FLOPS-accuracy

our EfficientNet models are not only small, but also computational cheaper.

latency을 검증하기 위해 inference latency 도 측정 → Table 4

5.3. Transfer Learning Results for EfficientNet

Table 5 shows the transfer learning performance:

(1) Compared to public available models, such as NASNet-A (Zoph et al., 2018) and Inception-v4 (Szegedy et al., 2017),

(2) Compared to stateof-the-art models, including DAT (Ngiam et al., 2018) that dynamically synthesizes training data and GPipe (Huang et al., 2018)

Figure 6 compares the accuracy-parameters curve for a variety of models.

6. Discussion

Figure 8 Compound scaling에서 2.5%

Figure 7 class activation map (Zhou et al., 2016),

해당 통계는 Table 7에서 보여준다.

Images는 random으로 ImageNet validation set에서 선택되였다.

Figure 7에서 볼 수 있듯이 compound scaling 이 있는 model은 object details 정보가 더 많은 관련 region에 focus을 맞추는 경향이 있는 반면, 다른 models은 object details 정보가 부족하거나 이미지의 모든 objects를 capture 할 수 없다.

반응형
반응형

github 소스 

 

GitHub - WongKinYiu/yolov7: Implementation of paper - YOLOv7: Trainable bag-of-freebies sets new state-of-the-art for real-time

Implementation of paper - YOLOv7: Trainable bag-of-freebies sets new state-of-the-art for real-time object detectors - GitHub - WongKinYiu/yolov7: Implementation of paper - YOLOv7: Trainable bag-of...

github.com

 

소스 다운하기 :

!git clone https://github.com/WongKinYiu/yolov7.git

이동하기 :

%cd yolov7

lib 설치하기

!pip install -U -r requirements.txt

1. Yolov7 coco dataset 학습하기 

 

train: WARNING: Ignoring corrupted image and/or label coco/images/train2017/000000189778.jpg: [Errno 2] No such file or directory: 'coco/images/train2017/000000189778.jpg'

./data/coco.yaml을 수정한다. 

# train and val data as 1) directory: path/images/, 2) file: path/images.txt, or 3) list: [path1/images/, path2/images/]
train: ./data/coco/train2017.txt  # 118287 images
val: ./data/coco/val2017.txt  # 5000 images
test: ./data/coco/test-dev2017.txt  # 20288 of 40670 images, submit to https://competitions.codalab.org/competitions/20794

 

github에서 수정하지 한다 .

!python train.py --workers 8 --device 0 --batch-size 32 --data data/coco.yaml --img 640 640 --cfg cfg/training/yolov7.yaml --weights '' --name yolov7 --hyp data/hyp.scratch.p5.yaml

정상적으로 수행하는 것을 확인할 수 있다. 

default 값은 아래와 같다. 

YOLOR 🚀 v0.1-115-g072f76c torch 1.12.1+cu113 CUDA:0 (Tesla T4, 15109.75MB) Namespace(adam=False, artifact_alias='latest', batch_size=32, bbox_interval=-1, bucket='', cache_images=False, cfg='cfg/training/yolov7.yaml', data='data/coco.yaml', device='0', entity=None, epochs=300, evolve=False, exist_ok=False, freeze=[0], global_rank=-1, hyp='data/hyp.scratch.p5.yaml', image_weights=False, img_size=[640, 640], label_smoothing=0.0, linear_lr=False, local_rank=-1, multi_scale=False, name='yolov7', noautoanchor=False, nosave=False, notest=False, project='runs/train', quad=False, rect=False, resume=False, save_dir='runs/train/yolov7', save_period=-1, single_cls=False, sync_bn=False, total_batch_size=32, upload_dataset=False, v5_metric=False, weights='', workers=8, world_size=1) tensorboard: Start with 'tensorboard --logdir runs/train', view at http://localhost:6006/ hyperparameters: lr0=0.01, lrf=0.1, momentum=0.937, weight_decay=0.0005, warmup_epochs=3.0, warmup_momentum=0.8, warmup_bias_lr=0.1, box=0.05, cls=0.3, cls_pw=1.0, obj=0.7, obj_pw=1.0, iou_t=0.2, anchor_t=4.0, fl_gamma=0.0, hsv_h=0.015, hsv_s=0.7, hsv_v=0.4, degrees=0.0, translate=0.2, scale=0.9, shear=0.0, perspective=0.0, flipud=0.0, fliplr=0.5, mosaic=1.0, mixup=0.15, copy_paste=0.0, paste_in=0.15, loss_ota=1 wandb: Install Weights & Biases for YOLOR logging with 'pip install wandb' (recommended)

여기에서 알 수 있다 싶이 epochs 가 300이다 . 

1-1. epochs 수정해서 수행하기 

!python train.py --workers 8 --epochs 1 --device 0 --batch-size 32 --data data/coco.yaml --img 640 640 --cfg cfg/training/yolov7.yaml --weights '' --name yolov7 --hyp data/hyp.scratch.p5.yaml

 

반응형

'Deep learning > 소스' 카테고리의 다른 글

yolov5 Multi-GPU Training  (0) 2021.09.22
yolov5 coco data set training  (0) 2021.09.17
classification mnist-LeNet-5  (0) 2021.04.03
yolov5 모델pt  (0) 2021.03.26
classification model code  (0) 2021.01.14
반응형

출처 : 프로그러머스

 

프로그래머스

코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.

programmers.co.kr

문제 설명

프렌즈4블록

블라인드 공채를 통과한 신입 사원 라이언은 신규 게임 개발 업무를 맡게 되었다. 이번에 출시할 게임 제목은 "프렌즈4블록".
같은 모양의 카카오프렌즈 블록이 2×2 형태로 4개가 붙어있을 경우 사라지면서 점수를 얻는 게임이다.


만약 판이 위와 같이 주어질 경우, 라이언이 2×2로 배치된 7개 블록과 콘이 2×2로 배치된 4개 블록이 지워진다. 같은 블록은 여러 2×2에 포함될 수 있으며, 지워지는 조건에 만족하는 2×2 모양이 여러 개 있다면 한꺼번에 지워진다.

블록이 지워진 후에 위에 있는 블록이 아래로 떨어져 빈 공간을 채우게 된다.

만약 빈 공간을 채운 후에 다시 2×2 형태로 같은 모양의 블록이 모이면 다시 지워지고 떨어지고를 반복하게 된다.

위 초기 배치를 문자로 표시하면 아래와 같다.

TTTANT
RRFACC
RRRFCC
TRRRAA
TTMMMF
TMMTTJ

각 문자는 라이언(R), 무지(M), 어피치(A), 프로도(F), 네오(N), 튜브(T), 제이지(J), 콘(C)을 의미한다

입력으로 블록의 첫 배치가 주어졌을 때, 지워지는 블록은 모두 몇 개인지 판단하는 프로그램을 제작하라.

입력 형식

  • 입력으로 판의 높이 m, 폭 n과 판의 배치 정보 board가 들어온다.
  • 2 ≦ n, m ≦ 30
  • board는 길이 n인 문자열 m개의 배열로 주어진다. 블록을 나타내는 문자는 대문자 A에서 Z가 사용된다.

출력 형식

입력으로 주어진 판 정보를 가지고 몇 개의 블록이 지워질지 출력하라.

입출력 예제

mnboardanswer
4 5 ["CCBDE", "AAADE", "AAABF", "CCBBF"] 14
6 6 ["TTTANT", "RRFACC", "RRRFCC", "TRRRAA", "TTMMMF", "TMMTTJ"] 15

예제에 대한 설명

  • 입출력 예제 1의 경우, 첫 번째에는 A 블록 6개가 지워지고, 두 번째에는 B 블록 4개와 C 블록 4개가 지워져, 모두 14개의 블록이 지워진다.
  • 입출력 예제 2는 본문 설명에 있는 그림을 옮긴 것이다. 11개와 4개의 블록이 차례로 지워지며, 모두 15개의 블록이 지워진다.

해설 보러가기

 

문제를 보고 3가지 부분으로 나누었다. 

1. 4개 짜리 있는 부분 list에 담기

2. 4개 있는 list를 순환하여 그 부분 ' ' 으로 채우기 

3. 마지막에 중요하다고 느낀 것은 이부분이다. 아래로 미루는 부분에서 많이 틀린 경우가 많다. 이 경우 초반에 잘못해서 5,10이 틀렸다. 

 

def solution(m, n, board):
    answer = 0
    board = [[j for j in i ] for i in board ]
    while True:
        list_= []
        # 4개 있는 점 찾기 
        for i in range(m-1):
            for j in range(n-1):
                if board[i][j] != ' ' and (board[i][j] == board[i+1][j] == board[i+1][j+1] == board[i+1][j+1]== board[i][j + 1]):
                    list_.append((i+1,j+1))
                    list_.append((i+1,j))
                    list_.append((i,j+1))
                    list_.append((i,j))        

        # 4개 있는 곳 지워주기 
        answer += len(set(list_))
        if len(list_) == 0:
            return answer
        for i,j in list_:
            board[i][j] = ' '
        
        # 보드를 아래 루 내리기
        while True:
            moved = False
            for i in range(1, m):
                for j in range(n):
                    if board[i-1][j] != ' '  and board[i][j] == ' ':
                        board[i][j] = board[i-1][j]
                        board[i-1][j] = ' '
                        moved = True
            if not moved:
                break
    return answer

m = 4
n = 5
board = ["CCBDE", "AAADE", "AAABF", "CCBBF"]
solution(m, n, board)

5점 

 

보드를 아래 루 내리기 한 부분에서 while문을 하여 중간에 있는 부분을 채워줘야 한다. 
한번만 해서 끝내는 것이 아니다. 
반응형

'문제 > 프로그래머스' 카테고리의 다른 글

정수를 나선형으로 배치하기  (0) 2023.06.11
피로도  (0) 2022.08.06
H-Index  (0) 2022.06.30
이중우선순위큐  (0) 2022.06.21
디스크 컨트롤러  (0) 2022.06.15
반응형

출처 : 프로그래머스

 

프로그래머스

코드 중심의 개발자 채용. 스택 기반의 포지션 매칭. 프로그래머스의 개발자 맞춤형 프로필을 등록하고, 나와 기술 궁합이 잘 맞는 기업들을 매칭 받으세요.

programmers.co.kr

문제 설명

XX게임에는 피로도 시스템(0 이상의 정수로 표현합니다)이 있으며, 일정 피로도를 사용해서 던전을 탐험할 수 있습니다. 이때, 각 던전마다 탐험을 시작하기 위해 필요한 "최소 필요 피로도"와 던전 탐험을 마쳤을 때 소모되는 "소모 피로도"가 있습니다. "최소 필요 피로도"는 해당 던전을 탐험하기 위해 가지고 있어야 하는 최소한의 피로도를 나타내며, "소모 피로도"는 던전을 탐험한 후 소모되는 피로도를 나타냅니다. 예를 들어 "최소 필요 피로도"가 80, "소모 피로도"가 20인 던전을 탐험하기 위해서는 유저의 현재 남은 피로도는 80 이상 이어야 하며, 던전을 탐험한 후에는 피로도 20이 소모됩니다.

이 게임에는 하루에 한 번씩 탐험할 수 있는 던전이 여러개 있는데, 한 유저가 오늘 이 던전들을 최대한 많이 탐험하려 합니다. 유저의 현재 피로도 k와 각 던전별 "최소 필요 피로도", "소모 피로도"가 담긴 2차원 배열 dungeons 가 매개변수로 주어질 때, 유저가 탐험할수 있는 최대 던전 수를 return 하도록 solution 함수를 완성해주세요.

제한사항
  • k는 1 이상 5,000 이하인 자연수입니다.
  • dungeons의 세로(행) 길이(즉, 던전의 개수)는 1 이상 8 이하입니다.
    • dungeons의 가로(열) 길이는 2 입니다.
    • dungeons의 각 행은 각 던전의 ["최소 필요 피로도", "소모 피로도"] 입니다.
    • "최소 필요 피로도"는 항상 "소모 피로도"보다 크거나 같습니다.
    • "최소 필요 피로도"와 "소모 피로도"는 1 이상 1,000 이하인 자연수입니다.
    • 서로 다른 던전의 ["최소 필요 피로도", "소모 피로도"]가 서로 같을 수 있습니다.
입출력 예kdungeonsresult
80 [[80,20],[50,40],[30,10]] 3
입출력 예 설명

현재 피로도는 80입니다.

만약, 첫 번째 → 두 번째 → 세 번째 던전 순서로 탐험한다면

  • 현재 피로도는 80이며, 첫 번째 던전을 돌기위해 필요한 "최소 필요 피로도" 또한 80이므로, 첫 번째 던전을 탐험할 수 있습니다. 첫 번째 던전의 "소모 피로도"는 20이므로, 던전을 탐험한 후 남은 피로도는 60입니다.
  • 남은 피로도는 60이며, 두 번째 던전을 돌기위해 필요한 "최소 필요 피로도"는 50이므로, 두 번째 던전을 탐험할 수 있습니다. 두 번째 던전의 "소모 피로도"는 40이므로, 던전을 탐험한 후 남은 피로도는 20입니다.
  • 남은 피로도는 20이며, 세 번째 던전을 돌기위해 필요한 "최소 필요 피로도"는 30입니다. 따라서 세 번째 던전은 탐험할 수 없습니다.

만약, 첫 번째 → 세 번째 → 두 번째 던전 순서로 탐험한다면

  • 현재 피로도는 80이며, 첫 번째 던전을 돌기위해 필요한 "최소 필요 피로도" 또한 80이므로, 첫 번째 던전을 탐험할 수 있습니다. 첫 번째 던전의 "소모 피로도"는 20이므로, 던전을 탐험한 후 남은 피로도는 60입니다.
  • 남은 피로도는 60이며, 세 번째 던전을 돌기위해 필요한 "최소 필요 피로도"는 30이므로, 세 번째 던전을 탐험할 수 있습니다. 세 번째 던전의 "소모 피로도"는 10이므로, 던전을 탐험한 후 남은 피로도는 50입니다.
  • 남은 피로도는 50이며, 두 번째 던전을 돌기위해 필요한 "최소 필요 피로도"는 50이므로, 두 번째 던전을 탐험할 수 있습니다. 두 번째 던전의 "소모 피로도"는 40이므로, 던전을 탐험한 후 남은 피로도는 10입니다.

따라서 이 경우 세 던전을 모두 탐험할 수 있으며, 유저가 탐험할 수 있는 최대 던전 수는 3입니다.


※ 공지 - 2022년 2월 25일 테스트케이스가 추가되었습니다.

아래 소스를 참고 하고 수정하였다.

answer = 0
def enter_dungen(dungeons, k, idx, visited):
    global answer
    k -= dungeons[idx][1] # 소모 피로도를 줄인다. 
    answer = max(answer, sum(visited))
    
    for idx_2, val_2 in enumerate(dungeons):
        #print(idx, idx_2, val_2)
        if not visited[idx_2] and  k >= val_2[0]:  # 방문하지 않고 소모도가 클 경우 
            visited[idx_2] = 1
            enter_dungen(dungeons, k, idx_2, visited)
            visited[idx_2] = 0
    return answer
    
def solution(k, dungeons):
    for idx, val in enumerate(dungeons):
        visited = [0] * len(dungeons) # 합을 계산하기 쉽게 하였다 
        if k >= val[0]:# 처음이여서 소모도가 클 경우 
            visited[idx] = 1
            enter_dungen(dungeons, k, idx, visited)
            visited[idx] = 0
    return answer


k = 80
dungeons = [[80,20],[50,40],[30,10]]
solution(k, dungeons)

 

참고 소스: https://velog.io/@rltjr1092/%ED%94%84%EB%A1%9C%EA%B7%B8%EB%9E%98%EB%A8%B8%EC%8A%A4-%ED%94%BC%EB%A1%9C%EB%8F%84-%ED%8C%8C%EC%9D%B4%EC%8D%AC-%ED%92%80%EC%9D%B4

 

프로그래머스 피로도 파이썬 풀이

하루에 한번 만 탐험 할 수 있는 던전들이 있다.이 던전들은 각각 요구하는 최소 피로도와 탐험 후 소모되는 소모 피로도 값을 가지고 있다.던전들의 최소 피로도와 소모 피로도 값이 주어질 때

velog.io

 

반응형

'문제 > 프로그래머스' 카테고리의 다른 글

정수를 나선형으로 배치하기  (0) 2023.06.11
[1차] 프렌즈4블록  (1) 2022.10.01
H-Index  (0) 2022.06.30
이중우선순위큐  (0) 2022.06.21
디스크 컨트롤러  (0) 2022.06.15
반응형

https://arxiv.org/abs/1804.02767?fbclid=IwAR3A2nyK8EPa-JcoGp_N6tNqVkKOmy2J1ip5AYcEki5FzkZ62E3z6tbNSy0

 

YOLOv3: An Incremental Improvement

We present some updates to YOLO! We made a bunch of little design changes to make it better. We also trained this new network that's pretty swell. It's a little bigger than last time but more accurate. It's still fast though, don't worry. At 320x320 YOLOv3

arxiv.org

 

코드 : 

https://pjreddie.com/darknet/yolo/

 

YOLO: Real-Time Object Detection

YOLO: Real-Time Object Detection You only look once (YOLO) is a state-of-the-art, real-time object detection system. On a Pascal Titan X it processes images at 30 FPS and has a mAP of 57.9% on COCO test-dev. Comparison to Other Detectors YOLOv3 is extremel

pjreddie.com

Abstract

약간의 디자인 change를 했고 → 성능 , 속도를 향상 ⇒ ideas from other people

new network that’s pretty swell.

320 x 320 YOLOv3 runs in 22ms at 28.2 mAP, as accurate as SSD but three times faster.

코드 : https://pjreddie.com/darknet/yolo/

1. Introduction

YOLOV3

 

2. The Deal

2.1. Bounding Box Prediction

YOLO9000 bounding box를 예측하는데 dimension clusters anchor boxes로 사용한다.

4 coordinates for each bounding box

loss : sum of squared error loss

predicts an objectness score for each bounding box using logistic regression

threshold of .5

Faster RCCN과 달리 우리 시스템은 각 ground truth object 에 대해 하나의 bounding box를 할당한다.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

2.2. Class Prediction

multilabel classification를 사용하여 bounding box에 포함될 수 있는 class를 예측한다.

softmax를 상요하지 않고 대신 단순한 independent logistic classifiers를 사용한다. softmax를 사용하면 각 bounding box가 겹치는 레이블이 많을 경우 잘 안된다.

학습하는 동안 class predictions 을 위해 binary cross entropy loss을 사용한다.

A multilabel approach better models the data. ⇒ 겹치는 label에 대하여

 

2.3. Predictions Across Scales

boxes는 3가지 다른 scale에 대해서 예측한다.

we predict 3 boxes at each scale so the tensor is N × N × [3 ∗ (4 + 1 + 80)] for the 4 bounding box offsets, 1 objectness prediction, and 80 class predictions.

다음으로 우리는 previous layer 2개에서 feature map을 가져와 2x upsample 한다. 또한 network의 초기에서 feature map을 가져와 연결을 사용하여 upsampled 된 feature와 concatenation한다. ⇒ 이 방법을 사용하여 upsampled feature에서 더 의미 있는 의미 정보를 얻고 이전 feature map에서 더 세분화된 정보를 얻을 수 있다.

Feature Pyramid Network

We then add a few more convolutional layers to process this combined feature map, and eventually predict a similar tensor, although now twice the size.

COCO dataset the 9 clusters were: (10×13),(16×30),(33×23),(30×61),(62×45),(59×119),(116 × 90),(156 × 198),(373 × 326).

 

2.4. Feature Extractor

hybrid approach between the network used in YOLOv2, Darknet-19, and that newfangled residual network stuff

successive 3 × 3 and 1 × 1 convolutional layers but now has some shortcut connections

Darknet-53

 

 

2.5. Training

full image

multi-scale training, lots of data augmentation, batch normalization, all the standard stuff.

Darknet neural network framework for training and testing

 

3. How We Do

 

4. Things We Tried That Didn’t Work

Anchor box x, y offset predictions.

normal anchor box prediction mechanism ⇒ model stability를 감소시키고 잘 작동하지 않는다는 것을 발견

Linear x, y predictions instead of logistic.

linear activation to directly predict the x, y offset instead of the logistic activation ⇒ drop mAP

Focal loss.

dropped our mAP about 2 points. YOLOv3은 별도의 objectness predictions과 conditional class predictions 을 가지고 있기 때문에 focal loss 해결하려는 문제에 이미 강력하다.

Dual IOU thresholds and truth assignment.

Faster RCNN uses two IOU thresholds during training. ⇒ couldn’t get good results.

 

 

 

구글 번역기 참조 하였다. 

반응형
반응형

출처 : 프로그래머스

 

코딩테스트 연습 - H-Index

H-Index는 과학자의 생산성과 영향력을 나타내는 지표입니다. 어느 과학자의 H-Index를 나타내는 값인 h를 구하려고 합니다. 위키백과1에 따르면, H-Index는 다음과 같이 구합니다. 어떤 과학자가 발표

programmers.co.kr

  • H-Index
문제 설명

H-Index는 과학자의 생산성과 영향력을 나타내는 지표입니다. 어느 과학자의 H-Index를 나타내는 값인 h를 구하려고 합니다. 위키백과1에 따르면, H-Index는 다음과 같이 구합니다.

어떤 과학자가 발표한 논문 n편 중, h번 이상 인용된 논문이 h편 이상이고 나머지 논문이 h번 이하 인용되었다면 h의 최댓값이 이 과학자의 H-Index입니다.

어떤 과학자가 발표한 논문의 인용 횟수를 담은 배열 citations가 매개변수로 주어질 때, 이 과학자의 H-Index를 return 하도록 solution 함수를 작성해주세요.

제한사항
  • 과학자가 발표한 논문의 수는 1편 이상 1,000편 이하입니다.
  • 논문별 인용 횟수는 0회 이상 10,000회 이하입니다.
입출력 예citationsreturn
[3, 0, 6, 1, 5] 3
입출력 예 설명

이 과학자가 발표한 논문의 수는 5편이고, 그중 3편의 논문은 3회 이상 인용되었습니다. 그리고 나머지 2편의 논문은 3회 이하 인용되었기 때문에 이 과학자의 H-Index는 3입니다.

※ 공지 - 2019년 2월 28일 테스트 케이스가 추가되었습니다.

 

 

위키백과 의 h-index의 정의를 보는 것이 잴 빠르다. 

예에서 [30615] 정렬 후 처리 

0 6
1 5
2 3
3 1
4 0
def solution(citations):
    citations.sort(reverse = True)

    answer = 0
    for idx, val in enumerate(citations):
        if idx + 1 <= citations[idx]:
            print(idx+1, idx, citations[idx])
            answer = idx + 1
    return answer

citations = [3, 0, 6, 1, 5]
print(solution(citations))
반응형

'문제 > 프로그래머스' 카테고리의 다른 글

[1차] 프렌즈4블록  (1) 2022.10.01
피로도  (0) 2022.08.06
이중우선순위큐  (0) 2022.06.21
디스크 컨트롤러  (0) 2022.06.15
주식가격  (0) 2022.06.07
반응형

 출처 : 프로그래머스

 

코딩테스트 연습 - 이중우선순위큐

 

programmers.co.kr

def solution(operations):
    answer = []
    operations_after = []
    for operation in operations:
        opr, number = operation.split(" ")
        if opr == "I":
            operations_after.append(int(number))
        elif opr == "D" and number == "-1" and len(operations_after) > 0:
            operations_after.remove(min(operations_after))
        elif opr == "D" and number == "1" and len(operations_after) > 0:
            operations_after.remove(max(operations_after))
    opr_max = 0
    opr_min = 0
    if len(operations_after) >= 2:
        opr_max, opr_min = max(operations_after), min(operations_after)
    elif len(operations_after) == 1:
        if max(operations_after) < opr_max:
            opr_min = max(operations_after)
        else:
            opr_max = max(operations_after)
    answer.append(opr_max)
    answer.append(opr_min)
    return answer

#operations = ["I 16","D 1"]
operations = ["I 16", "I -5643", "D -1", "D 1", "D 1", "I 123", "D -1"]
print(solution(operations))
#operations= ["I 7","I 5","I -5","D -1"]
operations = 	["I -45", "I 653", "D 1", "I -642", "I 45", "I 97", "D 1", "D -1", "I 333"]
print(solution(operations))
반응형

'문제 > 프로그래머스' 카테고리의 다른 글

피로도  (0) 2022.08.06
H-Index  (0) 2022.06.30
디스크 컨트롤러  (0) 2022.06.15
주식가격  (0) 2022.06.07
다리를 지나는 트럭  (0) 2022.06.02

+ Recent posts