boazchung commited on
Commit
10fe1ec
1 Parent(s): 5b4bf00

Update index.js

Browse files
Files changed (1) hide show
  1. index.js +9 -7
index.js CHANGED
@@ -13,7 +13,9 @@ const EXAMPLE_URL = 'https://huggingface.co/datasets/Xenova/transformers.js-docs
13
 
14
  // Create a new object detection pipeline
15
  status.textContent = 'Loading model...';
16
- const detector = await pipeline('object-detection', 'Xenova/detr-resnet-50');
 
 
17
  status.textContent = 'Ready';
18
 
19
  example.addEventListener('click', (e) => {
@@ -42,12 +44,13 @@ async function detect(img) {
42
  imageContainer.style.backgroundImage = `url(${img})`;
43
 
44
  status.textContent = 'Analysing...';
45
- const output = await detector(img, {
46
- threshold: 0.5,
47
- percentage: true,
48
- });
49
- //console.log(output);
50
  status.textContent = '';
 
 
51
  output.forEach(renderBox);
52
  }
53
 
@@ -77,5 +80,4 @@ function renderBox({ box, label }) {
77
 
78
  boxElement.appendChild(labelElement);
79
  imageContainer.appendChild(boxElement);
80
- console.log(box, label);
81
  }
 
13
 
14
  // Create a new object detection pipeline
15
  status.textContent = 'Loading model...';
16
+ // To-Do #1 pipeline API를 사용하여 detr-resnet-50 object detection 모델의 instance를 detector라는 이름을 붙여 생성하십시오.
17
+ // DETR 모델 참고 문서 https://huggingface.co/facebook/detr-resnet-50
18
+ const detector = await '???';
19
  status.textContent = 'Ready';
20
 
21
  example.addEventListener('click', (e) => {
 
44
  imageContainer.style.backgroundImage = `url(${img})`;
45
 
46
  status.textContent = 'Analysing...';
47
+ // To-Do #2 detector 오브젝트에 객체 탐지를 위한 threshold argument를 0.5로 지정하고 그 결과를 output에 저장하십시오
48
+ const output = await detector(
49
+ // threshold argument 지정
50
+ );
 
51
  status.textContent = '';
52
+ // To do #3 output의 값을 브라우저의 콘솔에 출력하십시오.
53
+ // your code here
54
  output.forEach(renderBox);
55
  }
56
 
 
80
 
81
  boxElement.appendChild(labelElement);
82
  imageContainer.appendChild(boxElement);
 
83
  }