# 데이터 업로드

데이터를 업로드하려고 시도하기 전에 다음을 따라왔는지 확인하세요 [여기에 설명된 단계들을](/ko/python-sdk/getting-started.md) SDK를 설정하기 위해.

### 단일 유형의 데이터 업로드

```py
from mindkosh import Client

## 지정된 디렉터리에서 찾은 모든 이미지 파일 업로드
client.upload_data(
    dataset_id=dataset_id,
    resources=['/example_images/'],
    tags=['penguin'] ## 선택 사항
)

## 또는 업로드할 파일을 지정하세요
client.upload_data(
    dataset_id=dataset_id,
    resources=[
        '/home/user/Downloads/test1.pcd',
        '/home/user/Downloads/test2.pcd'
    ],
    tags=['forest'] ## 선택 사항
)
```

각 파일에 서로 다른 태그를 지정하려면 `ImageFile` 또는 `PointCloudFile` 객체를 사용할 수 있습니다.

```py
from mindkosh import Client, ImageFile

client.upload_imagefiles(
    dataset_id = dataset_id,
    imagefiles = [
        ImageFile(
            filepath='/path/to/image1',
            tags=["city1"]
        ),
        ImageFile(
            filepath='path/to/image2',
            tags=["city2"]
        )
    ]
)
```

{% hint style="info" %}
업로드된 파일이 처리되는 데 최대 2분이 걸릴 수 있습니다. 업로드한 데이터로 작업을 만들기 전에 파일이 처리될 시간을 충분히 주었는지 확인하세요. UI에서 모든 파일이 처리되었고 데이터세트에서 보이는지 확인할 수 있습니다.
{% endhint %}

###

### 라이다 + 카메라 데이터 업로드

라이다 포인트 클라우드 + 참조 카메라 이미지를 업로드하려면 포인트 클라우드 파일 객체를 만들고 카메라 이미지를 다음으로 지정하세요 `ImageFile` 객체. 사용할 수 있는 경우, 보정 파라미터를 외부 파라미터(라이다에서 카메라로의 투영용)와 내부 파라미터(카메라에서 이미지로의 투영용)로 지정할 수 있습니다. 이러한 파라미터가 지정되면 Mindkosh가 참조 카메라 이미지 위에 자동으로 직육면체 주석을 투영할 수 있습니다.

1. `intrinsic` - 다음 형식으로 지정됨 `[fx, fy, cx, cy]` 형식.
2. `extrinsic` - 포인트 클라우드 기준 프레임의 점을 카메라 기준 프레임으로 변환할 수 있는 4x4 변환 행렬로 지정됨.
3. `camera_model` - Mindkosh는 두 가지 카메라 모델을 지원합니다 - `PINHOLE` 은 가장 널리 사용되며, `FISHEYE` 입니다. Fisheye의 파라미터를 지정할 때는 `mirrorParameter` 도 설정해야 합니다.
4. 파라미터는 각 카메라와 각 프레임에 대해 별도로 설정됩니다. 장면 전체에서 값이 같더라도 마찬가지입니다.
5. `device_id` - 카메라를 식별하는 데 사용할 수 있는 고유한 번호입니다. 카메라들 사이에서만 고유하고 프레임 전체에서 동일하게 유지된다면 어떤 번호든 사용할 수 있습니다. 예를 들어 왼쪽 카메라와 오른쪽 카메라가 있다면 모든 프레임에서 각각 디바이스 ID 1과 2를 할당할 수 있습니다.

{% hint style="danger" %}
**Mindkosh는 데이터세트 내의 모든 파일 이름이 고유해야 합니다. 즉, 카메라 파일 이름이 같다면(예: 왼쪽과 오른쪽 카메라 모두 같은 `timestamp.png` 를 사용한다면), 카메라 접두사를 추가하여 이름이 고유하도록 변경해야 합니다.**
{% endhint %}

```py
from mindkosh import Client, PointCloudFile

pointcloudFrames = []
pcdfile1 = PointCloudFile(
    filepath = '/file/path1/pcd1.pcd',
    related_files = [
        ImageFile(
            filepath='/path/to/image1.png',
            tags=[],
            extra={
                ## 내부 카메라 파라미터 값은 다음 순서로 지정됩니다: 
                ### [fx, fy, cx, cy]
                "intrinsic": [255.520403, 449.883682, 250.828738, 255.237477],

                ## 외부 파라미터, 라이다에서 
                ## 카메라로의 4x4 투영 행렬을 지정
                "extrinsic": [
                    [-0.735827, -0.65789, -0.0384775, 0],
                    [0.6567956, -0.70452916, 0.00140833, 0],
                    [-0.02255652, -0.0248216, 0.9993586, 0],
                    [0, 0, 0, 1]
                ],

                # 카메라 투영 모델 - PINHOLE 또는 FISHEYE
                # FISHEYE의 경우 mirrorParameter도 지정해야 합니다
                "cameraModel": "PINHOLE",
                ## 장치 ID는 각 카메라마다 고유해야 합니다.
                "device_id": 1
            }
        )
    ]
)

pointcloudFiles.append(pcdfile1)

client.upload_pointcloud_data(dataset_id=datasetId, pointcloudfiles=pointcloudFrames)
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.mindkosh.com/ko/python-sdk/uploading-data.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
