> For the complete documentation index, see [llms.txt](https://docs.roboflow.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.roboflow.com/reference/ko/inference/inference-sdk/configuration.md).

# 구성

## 구성 옵션

### 컨텍스트 매니저를 사용한 구성

메서드 `use_configuration(...)` 및 `use_model(...)` 는 컨텍스트 매니저에서 작동하도록 설계되었습니다. **컨텍스트 매니저를 벗어나면 이전 구성 값이 복원됩니다.**

```python
from inference_sdk import InferenceHTTPClient, InferenceConfiguration

image_url = "https://source.roboflow.com/pwYAXv9BTpqLyFfgQoPZ/u48G0UpWfk8giSw7wrU8/original.jpg"

custom_configuration = InferenceConfiguration(confidence_threshold=0.8)
# ROBOFLOW_API_KEY를 Roboflow API 키로 바꾸세요
CLIENT = InferenceHTTPClient(
    api_url="http://localhost:9001",
    api_key="ROBOFLOW_API_KEY"
)

with CLIENT.use_configuration(custom_configuration):
    _ = CLIENT.infer(image_url, model_id="soccer-players-5fuqs/1")

with CLIENT.use_model("soccer-players-5fuqs/1"):
    _ = CLIENT.infer(image_url)

# 컨텍스트 매니저를 벗어난 후 - 변경 사항은 되돌려지고 `model_id`는 여전히 필요합니다
_ = CLIENT.infer(image_url, model_id="soccer-players-5fuqs/1")
```

보시다시피, `model_id` 는 기본 모델이 구성되어 있지 않을 때만 예측 메서드에 필요합니다.

{% hint style="info" %}
모델 ID는 문자열 `<project_id>/<version_id>`로 구성됩니다.  [워크스페이스 및 프로젝트 ID](/reference/ko/authentication/authentication/workspace-and-project-ids.md) 에서 이 정보를 찾을 수 있습니다.
{% endhint %}

### 구성을 한 번 설정하고 다음 변경 전까지 사용하기

메서드 `configure(...)` 및 `select_model(...)` 는 클라이언트 상태를 변경하며, 그 변경은 다음 변경 전까지 유지됩니다.

```python
from inference_sdk import InferenceHTTPClient, InferenceConfiguration

image_url = "https://source.roboflow.com/pwYAXv9BTpqLyFfgQoPZ/u48G0UpWfk8giSw7wrU8/original.jpg"

custom_configuration = InferenceConfiguration(confidence_threshold=0.8)
# ROBOFLOW_API_KEY를 Roboflow API 키로 바꾸세요
CLIENT = InferenceHTTPClient(
    api_url="http://localhost:9001",
    api_key="ROBOFLOW_API_KEY"
)

CLIENT.configure(custom_configuration)
CLIENT.infer(image_url, model_id="soccer-players-5fuqs/1")

# 사용자 정의 구성은 계속 유지됩니다
CLIENT.select_model(model_id="soccer-players-5fuqs/1")
_ = CLIENT.infer(image_url)

# 사용자 정의 구성과 선택된 모델 - 계속 유지됩니다
_ = CLIENT.infer(image_url)
```

다음과 같은 방식으로 초기화할 수도 있습니다 `체인` 모드:

```python
from inference_sdk import InferenceHTTPClient, InferenceConfiguration

# ROBOFLOW_API_KEY를 Roboflow API 키로 바꾸세요
CLIENT = InferenceHTTPClient(api_url="http://localhost:9001", api_key="ROBOFLOW_API_KEY") \
    .select_model("soccer-players-5fuqs/1")
```

### 재정의하기 `model_id` 특정 호출에 대해

`model_id` 는 특정 호출에 대해 재정의할 수 있습니다:

```python
from inference_sdk import InferenceHTTPClient

image_url = "https://source.roboflow.com/pwYAXv9BTpqLyFfgQoPZ/u48G0UpWfk8giSw7wrU8/original.jpg"

# ROBOFLOW_API_KEY를 Roboflow API 키로 바꾸세요
CLIENT = InferenceHTTPClient(api_url="http://localhost:9001", api_key="ROBOFLOW_API_KEY") \
    .select_model("soccer-players-5fuqs/1")

_ = CLIENT.infer(image_url, model_id="another-model/1")
```

## 클라이언트 구성에 대한 세부 정보

`InferenceHTTPClient` 는 `InferenceConfiguration` 데이터 클래스를 제공하여 전체 구성을 보관합니다.

```python
from inference_sdk import InferenceConfiguration
```

이 구성의 필드를 재정의하면 클라이언트의 동작(및 모델을 제공하는 API의 동작)이 변경됩니다. 특정 필드는 특정 맥락에서 사용됩니다. 특히:

### 분류 모델

* `visualize_predictions`: 시각화를 활성화 / 비활성화하는 플래그
* `confidence_threshold` 을 `confidence`
* `stroke_width`: 시각화에서 선의 너비
* `disable_preproc_auto_orientation`, `disable_preproc_contrast`, `disable_preproc_grayscale`, `disable_preproc_static_crop` 서버 측 전처리를 변경하기 위해
* `disable_active_learning` 를 방지하기 위해 [Active Learning](https://docs.roboflow.com/deployment/monitoring-and-analytics/active-learning) 기능이 데이터 포인트를 등록하는 것을 막기 위해 사용됩니다(예를 들어 모델을 테스트할 때 유용할 수 있습니다)
* `active_learning_target_dataset` - 특정 모델에서 추론할 때(예를 들어 `project_a/1`) 다른 프로젝트에 데이터를 저장하고 싶다면 `project_b`가 이 매개변수로 지정되어야 합니다. **같은 프로젝트 `project_a` 및 `project_b`에서 서로 다른 유형의 모델을 사용할 수는 없다는 점에 유의하세요. 그런 경우 데이터는 등록되지 않습니다.**
* `source`: 추론 호출에 "source" 속성을 설정하는 선택적 문자열입니다.  [모델 모니터링](https://docs.roboflow.com/deployment/monitoring-and-analytics/model-monitoring)을 사용 중이라면, 이 값은 추론 요청과 함께 기록되므로 특정 출처에서 오는 추론 요청을 필터링하거나 조회할 수 있습니다. 예를 들어 어떤 애플리케이션, 시스템 또는 배포가 요청을 보내는지 식별하는 데 사용할 수 있습니다.
* `source_info`: 추론 호출에 추가 "source\_info" 속성을 설정하는 선택적 문자열입니다. 예를 들어 앱 내의 하위 구성 요소를 식별하는 데 사용할 수 있습니다.

### 객체 탐지 모델

* `visualize_predictions`: 시각화를 활성화 / 비활성화하는 플래그
* `visualize_labels`: 시각화가 활성화된 경우 레이블 시각화를 활성화 / 비활성화하는 플래그
* `confidence_threshold` 을 `confidence`
* `class_filter` 클래스 목록을 필터링하기 위해
* `class_agnostic_nms`: NMS가 클래스 비의존적인지 제어하는 플래그
* `fix_batch_size`
* `iou_threshold`: NMS IoU 임계값을 지정하기 위해
* `stroke_width`: 시각화에서 선의 너비
* `max_detections`: 모델에서 반환할 최대 탐지 수
* `max_candidates`: 모델의 후처리를 위한 최대 후보 수
* `disable_preproc_auto_orientation`, `disable_preproc_contrast`, `disable_preproc_grayscale`, `disable_preproc_static_crop` 서버 측 전처리를 변경하기 위해
* `disable_active_learning`, `active_learning_target_dataset`, `source`, `source_info` - 위에 설명된 대로

### 키포인트 탐지 모델

* `visualize_predictions`: 시각화를 활성화 / 비활성화하는 플래그
* `visualize_labels`: 시각화가 활성화된 경우 레이블 시각화를 활성화 / 비활성화하는 플래그
* `confidence_threshold` 을 `confidence`
* `keypoint_confidence_threshold` (즉 `keypoint_confidence`) 모델 신뢰도를 기준으로 탐지된 키포인트를 필터링하기 위해
* `class_filter` 객체 클래스 목록을 필터링하기 위해
* `class_agnostic_nms`: NMS가 클래스 비의존적인지 제어하는 플래그
* `fix_batch_size`
* `iou_threshold`: NMS IoU 임계값을 지정하기 위해
* `stroke_width`: 시각화에서 선의 너비
* `max_detections`: 모델에서 반환할 최대 탐지 수
* `max_candidates`: 모델의 후처리를 위한 최대 후보 수
* `disable_preproc_auto_orientation`, `disable_preproc_contrast`, `disable_preproc_grayscale`, `disable_preproc_static_crop` 서버 측 전처리를 변경하기 위해
* `disable_active_learning`, `active_learning_target_dataset`, `source`, `source_info` - 위에 설명된 대로

### 인스턴스 분할 모델

* `visualize_predictions`: 시각화를 활성화 / 비활성화하는 플래그
* `visualize_labels`: 시각화가 활성화된 경우 레이블 시각화를 활성화 / 비활성화하는 플래그
* `confidence_threshold` 을 `confidence`
* `class_filter` 클래스 목록을 필터링하기 위해
* `class_agnostic_nms`: NMS가 클래스 비의존적인지 제어하는 플래그
* `fix_batch_size`
* `iou_threshold`: NMS IoU 임계값을 지정하기 위해
* `stroke_width`: 시각화에서 선의 너비
* `max_detections`: 모델에서 반환할 최대 탐지 수
* `max_candidates`: 모델의 후처리를 위한 최대 후보 수
* `disable_preproc_auto_orientation`, `disable_preproc_contrast`, `disable_preproc_grayscale`, `disable_preproc_static_crop` 서버 측 전처리를 변경하기 위해
* `mask_decode_mode`
* `tradeoff_factor`
* `disable_active_learning`, `active_learning_target_dataset`, `source`, `source_info` - 위에 설명된 대로

### 클라이언트의 구성

* `output_visualisation_format`: 다음 중 하나 `VisualisationResponseFormat.BASE64`, `VisualisationResponseFormat.NUMPY`, `VisualisationResponseFormat.PILLOW`. 서버 측 시각화가 활성화되어 있다면, 출력에 사용할 형식을 선택할 수 있습니다.
* `client_downsizing_disabled`: 다음으로 설정 `False` 로 설정하면 클라이언트 측 축소를 수행할 수 있습니다. 기본값은 `True`입니다. 클라이언트 측 스케일링은 인터넷 연결을 더 효율적으로 활용하기 위해 추론 입력을 (종횡비를 유지하며) 축소하는 데만 사용되어야 합니다(이미지 조작 / 트랜스코딩 비용이 따릅니다). 모델 입력 크기 정보는 대상 크기를 결정하는 데 사용되며, 사용할 수 없는 경우 `default_max_input_size` 가 사용됩니다.
* `max_concurrent_requests`: 시작될 수 있는 동시 요청의 최대 수
* `max_batch_size`: 단일 요청에 주입할 수 있는 요소의 최대 수
* `workflow_run_retries_enabled`: Workflows 실행에서의 일시적인 오류를 재시도할지 결정하는 플래그입니다. 기본값은 `true` 이며 기본값은 환경 변수 `WORKFLOW_RUN_RETRIES_ENABLED`.

### Workflows 실행 구성

* `profiling_directory`: Workflows 프로파일러 추적이 저장되는 위치를 지정합니다. 기본적으로는 `./inference_profiling` 디렉터리입니다.
